Apache 对于firefox来说,这个网站速度非常慢,在其他浏览器上都是即时的:KeepAlive问题?

Apache 对于firefox来说,这个网站速度非常慢,在其他浏览器上都是即时的:KeepAlive问题?,apache,http,firefox,keep-alive,content-length,Apache,Http,Firefox,Keep Alive,Content Length,我有一个网站,用firefox加载一个页面需要10秒,加载图像需要10秒。这是一个在apache上运行的php页面。这些图像只是静态图像 它在chrome上运行得非常漂亮。。。。即时加载 通过谷歌搜索答案,我发现keep alive可能存在一个问题,内容长度的缺乏让firefox感到困惑,事实上,服务器似乎没有在静态或非静态内容上设置内容长度,但在服务器上禁用keep alive会使加载时间加倍 一些网站建议禁用浏览器上的keep alive,但我不愿意向所有浏览该页面的人推荐!我是不是找错人了

我有一个网站,用firefox加载一个页面需要10秒,加载图像需要10秒。这是一个在apache上运行的php页面。这些图像只是静态图像

它在chrome上运行得非常漂亮。。。。即时加载


通过谷歌搜索答案,我发现keep alive可能存在一个问题,内容长度的缺乏让firefox感到困惑,事实上,服务器似乎没有在静态或非静态内容上设置内容长度,但在服务器上禁用keep alive会使加载时间加倍

一些网站建议禁用浏览器上的keep alive,但我不愿意向所有浏览该页面的人推荐!我是不是找错人了

ServerRoot "/etc/apache2"

LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>
DefaultType text/plain
HostnameLookups Off
ErrorLog /var/log/apache2/error.log
LogLevel warn
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Include /etc/apache2/httpd.conf
Include /etc/apache2/ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
浏览器是Lucid Lynx上的firefox 3.6.8。服务器是Apache2.2.11

apache.conf是。。。我认为这是一个现成的方法,尽管我将KeepAlive超时时间减少到了3,但徒劳地尝试加载页面

我找错树了吗

ServerRoot "/etc/apache2"

LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>
DefaultType text/plain
HostnameLookups Off
ErrorLog /var/log/apache2/error.log
LogLevel warn
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Include /etc/apache2/httpd.conf
Include /etc/apache2/ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
ServerRoot”/etc/apache2“
LockFile/var/lock/apache2/accept.lock
PidFile${APACHE_PID_文件}
超时300
继续
MaxKeepAliveRequests 100
保持超时
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
StartServers 2
MaxClients 150
Minspare25
MaxSpareThreads 75
螺纹预裂25
MaxRequestsPerChild 0
用户${APACHE\u RUN\u User}
组${APACHE\u RUN\u Group}
AccessFileName.htaccess
命令允许,拒绝
全盘否定
默认类型文本/纯文本
主机名查询
ErrorLog/var/log/apache2/error.log
日志级别警告
Include/etc/apache2/mods enabled/*.load
Include/etc/apache2/mods enabled/*.conf
Include/etc/apache2/httpd.conf
Include/etc/apache2/ports.conf
日志格式“%v:%p%h%l%u%t\%r\“%>s%b\”%{Referer}i\“\”%{User-Agent}i\\”vhost\u
日志格式“%h%l%u%t\%r\”%>s%b\“%%{Referer}i\\\“%%{User Agent}i\\”组合
日志格式“%h%l%u%t\%r\”%>s%b”通用
日志格式“%{Referer}i->%U”Referer
日志格式“%{User agent}i”代理
CustomLog/var/log/apache2/other_vhost_access.log vhost_组合
包括/etc/apache2/conf.d/
已启用Include/etc/apache2/站点/

不要禁用保持活动状态。它使得一个连接可以用于获取多个页面(或图像、或.js文件、或.css文件等),从而显著减少页面加载时间


只要确保您的脚本添加内容长度标题,一切都会正常。

问题在于本地DNS查找。命令行DNS解析似乎还可以,而chrome的速度非常快,这一事实掩盖了这个问题。chrome使用DNS预取,而不使用本地网络堆栈。这使我完全走错了方向

在创建了本地绑定服务之后,firefox似乎工作得很好


因此,当在与其他浏览器相同的平台上运行chrome时,需要注意一些事情。

您可以链接到实际的站点吗?是重JS吗?我已经在上建立了一个测试站点,我已经在那个站点上发布了一些时间安排。。。DNS查找没有问题。。目前我认为这是一个奇怪的firefox bug。。我将在windows版本的firefox上尝试此功能,可能还有IE或其他版本的firefox。我已经在许多其他网站上运行了篡改数据工具,看起来这是我的firefox安装在许多网站上遇到的一个问题,但被本地缓存屏蔽了。这可能是一个本地网络问题。“保持活动和内容长度不足可能是一个问题”-你能提供一些参考吗?TIAI将查看php脚本,但是apache不应该将内容长度添加到静态文件中吗?想想看,我也从来没有手动将内容长度添加到php文件中……Apache应该这样做,是的。但只要从简单的事情开始。内容长度问题可能会给分块传输、https和我多年来看到的各种奇怪现象带来麻烦。只需按规范执行即可:指定一个Content-Length.am读取wc3规范,该规范规定,在传输之前已知内容长度时,应设置内容长度。如果内容是动态生成的,那么确定价值的最佳实践是什么?如何让apache设置静态图形文件的内容长度?我不知道apache,我认为当keepalive打开时,它会设置内容长度。从php脚本中获取内容长度,通常(例如)是在生成输出后调用ob_get_length()来完成的。(是的,在这种情况下,您必须使用输出缓冲)在某些情况下,您可能提前知道内容长度。好的,我对静态文件也有同样的问题,而且服务器正在提供内容长度标题,因此我暂时搁置这一查询行。我已经在测试现场发布了相关数据。