我们网页的大部分内容都是由服务器端的包含或后期的页面加载AJAX调用生成的,因此HTML文件的大小一般相当小.但是,当创建测试页面时,没有任何复杂的东西,我发现如果页面大小超过8000个字符,服务器不会传输页面.
这是一个示例文件:
<!DOCTYPE html> <html> <head> <title>Rubbish</title> </head> <body> Lorem ipsum dolor sit amet,consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,sunt in culpa qui officia deserunt mollit anim id est laborum.<br />
重复最后一行16次,共计完成17条.然后添加一行的这一部分:
Lorem ipsum dolor sit amet,quis nostrud exercitation ullamco laboris nisi ut aliq.<br /> </body> </html>
以上是共有8001个字符,无法加载消息“Safari无法加载页面,因为服务器意外关闭连接”以及使用Firefox和Chrome的变体.删除最后的完整停止或任何其他字符会使字符倒数,因此页面按预期加载.
任何人都可以给我一个线索,说明我没有能够加载这样一个简单的文件吗?
答案(一种):很明显,这是mod_deflate导致问题,所以在一些谷歌搜索后,我问服务器缺失,如果有人知道如何改变最大的大小.没有响应,所以我创建了一个shell文件,并将原始的8000个字符文件作为服务器端包含(SSI),它现在按预期工作.仍然不知道为什么在纯HTML上有限制,但在SSI上没有限制,但是我没有时间再担心.
编辑:删除“SetOutputFilter DEFLATE”指令,现在加载页面,这表明它确实是导致问题的deflate模块.添加“DeflateBufferSize 10000”(或者“DeflateBufferSize 2048”)对所支持的大小没有任何影响,因此我将关闭此问题并询问服务器故障时的模块泄漏.
编辑:对不起,应该提到我们在Fedora 14上使用Apache 2.2.17.这是在笔记本电脑的虚拟机上,所以没有外部因素.
编辑:另外我应该补充的是,即使使用loglevel进行调试,Apache错误日志中也没有任何内容.访问日志提供“200”消息,但发送的字符数设置为“ – ”.
编辑:以下是编辑httpd.conf,没有其他配置文件.输出放大,然后由客户端解压缩:
### Section 1: Global Environment ServerTokens prod CoreDumpDirectory /tmp ServerRoot "/etc/httpd" PidFile run/httpd.pid Timeout 120 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5 <IfModule prefork.c> StartServers 20 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000 </IfModule> <IfModule worker.c> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule> Listen 80 #SOME LOAD MODULE CONFIG LINES REMOVED LoadModule include_module modules/mod_include.so LoadModule env_module modules/mod_env.so LoadModule ext_filter_module modules/mod_ext_filter.so LoadModule expires_module modules/mod_expires.so LoadModule deflate_module modules/mod_deflate.so LoadModule headers_module modules/mod_headers.so LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule info_module modules/mod_info.so LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule actions_module modules/mod_actions.so LoadModule cache_module modules/mod_cache.so LoadModule cgi_module modules/mod_cgi.so Include conf.d/*.conf ExtendedStatus Off User apache Group apache ### Section 2: 'Main' server configuration ServerAdmin root@localhost ServerName www.example.com:80 UseCanonicalName Off DocumentRoot "/var/www/html" <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <IfModule mod_userdir.c> UserDir disabled </IfModule> DirectoryIndex index.html index.html.var AccessFileName .htaccess <Files ~ "^.ht"> Order allow,deny Deny from all </Files> TypesConfig /etc/mime.types DefaultType text/plain <IfModule mod_mime_magic.c> MIMEMagicFile conf/magic </IfModule> HostnameLookups Off #LOG CONFIG LINES REMOVED ServerSignature Off Alias /icons/ "/var/www/icons/" <Directory "/var/www/icons"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <IfModule mod_dav_fs.c> DAVLockDB /var/lib/dav/lockdb </IfModule> IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8 #ICON CONFIG LINES REMOVED ReadmeName README.html HeaderName HEADER.html IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t #LANGUAGE CONFIG LINES REMOVED AddDefaultCharset UTF-8 AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl AddHandler send-as-is asis AddHandler type-map var AddOutputFilter INCLUDES .html .xml AddType application/x-httpd-PHP .PHP .html Alias /error/ "/var/www/error/" <IfModule mod_negotiation.c> <IfModule mod_include.c> <Directory "/var/www/error"> AllowOverride None Options IncludesNoExec AddOutputFilter Includes html AddHandler type-map var Order allow,deny Allow from all LanguagePriority en es de fr ForceLanguagePriority Prefer Fallback </Directory> </IfModule> </IfModule> #BROWSER MATCH CONFIG LINES REMOVED <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> <Location /server-info> SetHandler server-info Order deny,allow Deny from all Allow from 127.0.0.1 </Location> ### Section 3: Virtual Hosts NameVirtualHost *:80 FcgidMaxRequestLen 2000000 FcgidMinProcessesPerClass 5 FcgidIdleTimeout 18000 FcgidioTimeout 60 TraceEnable Off SetEnvIf User-Agent ".*MSIE.*" ISIE true <VirtualHost *:80> ServerName www.example.com UseCanonicalName off DocumentRoot /etc/httpd/www/examples/ DirectoryIndex index.html index.html.var CheckSpelling on CheckCaSEOnly on <Directory /etc/httpd/www/examples/> Options Includes AllowOverride None Order Deny,Allow Allow from all Header Set Cache-Control "max-age=10" ExpiresActive On ExpiresByType text/html "access plus 10 seconds" ExpiresByType image/gif A259200 ExpiresByType image/jpg A3600 ExpiresByType text/html A259200 ExpiresByType image/ico A259200 SetOutputFilter DEFLATE </Directory> <Directory /> Order Deny,Allow Deny from All </Directory> #OTHER DIRECTORY CONFIG LINES REMOVED </VirtualHost>