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服务
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服务