http配置如何开启gzip网页压缩

1.httpd -M (查看是否加载了mod_deflate.so)


2.如果没加载那么运行一下命令
find / -name mod_deflate.c (查找文件)


3.进入到此文件夹-运行(apxs需要找到)


find / -name apxs


/usr/local/apache/bin/apxs -c -i -a mod_deflate.c


ll /usr/local/apache/modules/mod_deflate.so (查看是否安装好)


4.配置
vi httpd.conf


添加
<ifmodule mod_deflate.c>
    DeflateCompressionLevel 8
    AddOutputFilterByType DEFLATE text/htm
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/js
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE image/jepg
    AddOutputFilterByType DEFLATE image/gif
    AddOutputFilterByType DEFLATE image/png
    AddOutputFilterByType DEFLATE image/jpg
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE image/svg+xml
</ifmodule>


5.重启httpd服务
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值