日期:2014-05-17  浏览次数:20742 次

Apache开启gzip功能

1. httpd.conf中打开deflate_Module和headers_Module模块?robin

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

?.sh

2. httpd.conf中添加:

<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>
?