标签:
一、Apache开启gzip压缩模式
在目录apache\conf\httpd.conf
配置 httpd.conf 文件:
#去掉
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
#在文件的尾部添加一下代码:
#配置需要压缩的文件格式:
<ifmodule mod_deflate.c>
SetOutputFilter DEFLATE
#压缩级别,1-9,9为最高
DeflateCompressionLevel 6
#设置不对压缩的文件
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|exe|t?gz|zip|bz2|sit|rar|pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
标签:
原文地址:http://www.cnblogs.com/linjinzhuang/p/4691683.html