centos7 http Enable gzip

Just add this code to /etc/httpd/conf/httpd.conf

<IfModule deflate_module> 
SetOutputFilter DEFLATE
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|avi|mov|mp3|rm)$ no-gzip dont-vary 
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule> 

use command ” systemctl restart httpd” to restart httpd

发表评论

电子邮件地址不会被公开。 必填项已用*标注