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

时间:2010-08-06 22:36:04

标签: apache http firefox keep-alive content-length

我有一个网站,其中一个页面需要10秒才能加载firefox,还有10秒钟来加载图像。这是一个在apache上运行的php页面。图像只是静态图像。

它在镀铬上运行得很漂亮....即时加载。

谷歌搜索答案已经指出了一个可能存在的问题,即保持活力和缺乏内容长度令Firefox混淆,事实上,似乎服务器上没有静态或非静态内容设置内容长度,但在服务器上禁用keep alive会使加载时间加倍!

有些网站建议在浏览器上禁用“保持活动状态”,但我不愿意向所有查看该页面的人推荐!我是不是可能会吠叫错误的树?

浏览器是Lucid Lynx上的firefox 3.6.8。服务器是Apache 2.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/

2 个答案:

答案 0 :(得分:2)

问题在于本地DNS查找。命令行DNS解析似乎没问题,而且Chrome闪电般快速,这个问题就隐藏了。事实证明,chrome使用DNS预取,它不使用本地网络堆栈。这让我完全错了。

创建本地绑定服务后,firefox似乎运行良好。

在与其他浏览器相同的平台上运行chrome时需要注意的事项。

答案 1 :(得分:1)

不要禁用keep-alive。它使得一个连接可用于获取多个页面(或图像,或.js文件或.css文件等),从而显着减少页面加载时间。

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