gzip压缩

来源:互联网 发布:螃蟹 知乎 编辑:程序博客网 时间:2024/05/16 14:35

http://tool.chinaz.com/


httpd.conf中打开deflate_Module和headers_Module模块,具体做法为将 如下两句前面的#去掉:

LoadModule deflate_module modules/mod_deflate.so

LoadModule headers_module modules/mod_headers.so


在httpd.conf文件底部加入如下代码配置需要压缩的文件:

<IfModule deflate_module>
SetOutputFilter DEFLATE
# Don’t compress images and other 
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|doc)$ no-gzip dont-vary 
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>


原创粉丝点击