使用mod_deflate提升网页浏览的速度

2004年08月29日 06:29 查看5070次 作者: Boban  【
文章分类:PHP安装配置

apache1.3.x可以用mod_gzip进行优化网页浏览的速度,可以明显的感觉到速度的提升。在apache2中也尝试用mod_gzip,但是配置后确发现网页不能正确显示(空白页),所以改换mod_deflate。

在Linux命令行下运行以下命令安装mod_deflate模块(斜体是apache2的目录)

/usr/local/apache2/bin/apxs -i -c /root/httpd-2.0.48/modules/filters/mod_deflate.c

编辑httpd.conf,加入以下内容:

LoadModule deflate_module modules/mod_deflate.so

DeflateFilterNote ratio
LogFormat '"%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" (%{ratio}n)' deflate

<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch MSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI
.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
# Header命令不对?注释这一行
# Header append Vary User-Agent env=!dont-vary
</Location>

#查找Customlog 注释原来的的一行,改成
CustomLog logs/deflate_log deflate

Boban <boban@21php.com > 写于2004年3月27日凌晨
附注:关于mod_deflate的详细内容,可以参考http://httpd.apache.org/docs-2.0/mod/mod_deflate.html

责任编辑:admin

给文章打个分先...

平均分:0.8(26 次)

-5 -4 -3 -2 -1 0 1 2 3 4 5
1

顶一下

发表我的见解...

  • 您的大名: 留空为匿名
  • 您的主页:
  • 您的邮箱:

看看大家怎么说...

  • 创意产品 发表于09年05月03日 13:03

    没怎么用过