配置Apache模块mod_deflate失败

配置Apache模块mod_deflate失败

httpd.conf文件中加入:

AddOutputFilterByType DEFLATE text/html text/plain text/xml
DeflateCompressionLevelvalue 8
DeflateFilterNote ratio

LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
CustomLog logs/deflate_log deflate


日志文件:

"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"

网页没有被压缩,请高手赐教
我换了一台机器做了一下

httpd.conf文件中加入:

AddOutputFilterByType DEFLATE text/html text/plain text/xml
去掉了它DeflateCompressionLevelvalue 8
DeflateFilterNote ratio

LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
CustomLog logs/deflate_log deflate
出现的日志里包括"GET / HTTP/1.1" 24 (17) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"是否成功了?
[root@localhost conf]# cat ../logs/deflate_log
"GET / HTTP/1.1" 24 (17) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
"GET / HTTP/1.1" - (-) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
LoadModule deflate_module modules/mod_deflate.so
<IfModule mod_deflate.c>
#以下三句是启用deflate的日志
#DeflateFilterNote ratio
#LogFormat '"%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" (%{ratio}n)' deflate
#CustomLog logs/deflate_log deflate
#以上三句是启用deflate的日志
<Location />
# 插入过滤器
SetOutputFilter DEFLATE
# Netscape 4.x 有一些问题...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 有更多的问题
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE 会伪装成 Netscape ,但是事实上它没有问题
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# 不压缩图片
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# 确保代理不会发送错误的内容
Header append Vary User-Agent env=!dont-vary
</Location>
</IfModule>
我已经按照你说的设置了,deflate日志没有任何东西
没成功
请高手帮忙
抓包分析一下就知道有没有被压缩,用ab也能看到。