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