apache服务器启用gzip的方法
1、vi /etc/httpd/conf/httpd.conf
2、查找LoadModule (/LoadModule),加入一句(如果已有请不用修改)
LoadModule deflate_module modules/mod_deflate.so
3、添加以下配置项目,添加在任何部位都OK
# 压缩等级 9
DeflateCompressionLevel 9
# 压缩类型 html、xml、php、css、js
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/x-httpd-php
AddOutputFilter DEFLATE js css
4、重启apache web服务器:service httpd restart