http://www.javayou.com (收藏,设为首页)
当你不能再拥有时,你唯一能做的,就是让自己不要忘记 (手机请访问 http://3g.dlog.cn/javayou)
上一篇:春节 下一篇:IK_CAnalyzer的一个问题

mod_deflate的两种配置策略

2007年2月25日(Sunday) 15点31分 作者: 刘冬 天气: 心情: 一般
1 根据ContentType配置包含策略

If you want to compress HTML, text, and XML files only, add this line to your configuration:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

This is the configuration I'm using because I don't want to compress images or PDF files or already compressed files such as zip files.

2 通过文件扩展名配置排他策略

If you want to compress all file types and exclude just a few, you would add something like this to your configuration (instead of the line from section 2.1):

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

This would compress all files except images (gif, jpg, and png), already compressed files (like zip and tar.gz) and PDF files which makes sense because you do not gain much by compressing these file types.

标签: Apache mod_deflate 
姓名: 
邮箱:  {可选}
网址:  {可选} 此评论只有我和写日记的人查阅
校验码: ... <我看不清楚>
网记为您提供手机和互联网同步的个人主页,带给你不一样的体验