日期:2014-05-17  浏览次数:20789 次

mod_deflate的两种配置策略
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.

正文:http://www.dlog.cn/html/diary/showlog.vm?sid=2&cat_id=4&log_id=6305

------解决方案--------------------
文件扩展名配置排他策略 这个似乎会比较占资源
还是自己编辑mime.types,把要压缩的扩展类写到一个type里好