[ubuntu]Enable gzip compress for apache

2015-11-23 写技术

1.Edit the apache config file. Add/Open these contents:
#************* begin *********************
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

<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>
#************** end **********************

2.restart apache

标签: ubuntu

发表评论:

Powered by anycle 湘ICP备15001973号-1