Apache模块 mod_deflate 开启压缩
mod_deflate 模块提供了DEFLATE输出过滤器,允许服务器在将输出内容发送到客户端以前进行压缩,以节约带宽。
这是一个针对心急者的示范配置:
仅仅压缩少数几种类型
AddOutputFilterByType DEFLATE text/html text/plain text/xml
以下允许压缩更多内容的配置更加复杂。除非你明白所有的配置细节,否则请不要使用。
Compress everything except images
<Location />
# 插入过滤器
SetOutputFilter DEFLATE
# Netscape 4.x 有一些问题...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 有更多的问题
BrowserMatch ^Mozilla/4\.0 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>
原文:http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_deflate.html
页:
[1]