Apache-2.4------------ 启用Gzip压缩的方法(apache中虚拟主机配置优先生效)
1、开启模块mod_deflate和mod_filter
2、httpd.conf末尾添加以下内容
vi /etc/httpd/conf/httpd.conf
<IfModule mod_deflate.c>
DeflateCompressionLevel 9
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js
</IfModule>
3、重启apache
[root@Oldboy extra]# /application/apache/bin/apachectl -t
Syntax OK
[root@Oldboy extra]# /application/apache/bin/apachectl restart
4、测试是否开启gzip
(1) 使用curl查看是否开启gzip
[root@Oldboy ~]# curl -I -H "Accept-Encoding: gzip,deflate" http://bbs.etiantian.org
HTTP/1.1 200 OK
Date: Tue, 05 Jul 2016 03:25:58 GMT
Server: Apache/2.2.31 (Unix) DAV/2 PHP/5.5.32
Last-Modified: Mon, 04 Jul 2016 21:23:19 GMT
ETag: "60363-b-536d5f1f7cc62"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip

最低0.47元/天 解锁文章
518

被折叠的 条评论
为什么被折叠?



