Apache开启Gzip压缩

1. 编辑Apache的httpd.conf文件

vim /etc/httpd/conf/httpd.conf

2. 开启mod_deflate.so模块

LoadModule deflate_module modules/mod_deflate.so

3. 对该模块进行配置

# Shift+G到最下一行添加如下内容

<IfModule mod_deflate.c>
# 压缩等级 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
</IfModule>

 

posted @ 2015-08-11 11:35  zenghao  阅读(192)  评论(0编辑  收藏  举报