11 月 072016
 

CentOS 7 Apache 2.4开启Gzip压缩配置

确认以下模块配置未禁用

# vi /etc/httpd/conf.modules.d/00-base.conf

LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule filter_module modules/mod_filter.so

增加以下配置文件(文件类型或文件扩展名)

# vi /etc/httpd/conf.d/gzip.conf
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
DeflateCompressionLevel 9

# vi /etc/httpd/conf.d/gzip.conf
<filesMatch "\.(js|html|css)$">
 SetOutputFilter DEFLATE
</filesMatch>

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)