歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> apache如何開啟gzip壓縮,apache開啟gzip

apache如何開啟gzip壓縮,apache開啟gzip

日期:2017/3/3 18:10:51   编辑:學習Linux

apache如何開啟gzip壓縮,apache開啟gzip

apache如何開啟gzip壓縮,apache開啟gzip


1.找到/etc/httpd/conf/httpd.conf(linux下)並打開

2.在文件中找到deflate_Module和headers_Module模塊,將前面的#去掉

3.在文件底部添加

<IfModule deflate_module>
SetOutputFilter DEFLATE
# Don’t compress images and other
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:pdf|doc)$ no-gzip dont-vary
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

這段代碼

4.重啟apache服務器(service httpd restart)即可。

http://xxxxxx/Linuxjc/1162667.html TechArticle

Copyright © Linux教程網 All Rights Reserved