Summary of enabling the deflate method in apache

Source: Internet
Author: User
1. in httpd. add the following content to the site configuration in conf: AddOutputFilterByTypeDEFLATEtext/htmltext/plaintext/csstext/xmltext/javascriptDeflateCompressionLevel9SetOutputFilterDEFLATE2. in. htac 1. in httpd. add the following content to the site configuration in conf:
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript
DeflateCompressionLevel 9
 
SetOutputFilter DEFLATE
 
 
 
 
2. add the following content in. htaccess:
 

 
######################################## ####
# Enable apache served files compression
# Http://developer.yahoo.com/performance/rules.html#gzip
 
# Insert filter on all content
### SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
DeflateCompressionLevel 9
SetOutputFilter DEFLATE
 
# Netscape 4.x has some problems...
# BrowserMatch ^ Mozilla/4 gzip-only-text/html
 
# Netscape 4.06-4.08 have some more problems
# BrowserMatch ^ Mozilla/4 \. 0 [678] no-gzip
 
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \ bMSIE! No-gzip! Gzip-only-text/html
 
# Don't compress images
# SetEnvIfNoCase Request_URI \.(? : Gif | jpe? G | png) $ no-gzip dont-vary
 
# Make sure proxies don't deliver the wrong content
# Header append Vary User-Agent env =! Dont-vary
 
 

 
######################################## ####
# Enable apache served files compression
# Http://developer.yahoo.com/performance/rules.html#gzip
 
# Insert filter on all content
### SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
DeflateCompressionLevel 9
SetOutputFilter DEFLATE
 
# Netscape 4.x has some problems...
# BrowserMatch ^ Mozilla/4 gzip-only-text/html
 
# Netscape 4.06-4.08 have some more problems
# BrowserMatch ^ Mozilla/4 \. 0 [678] no-gzip
 
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \ bMSIE! No-gzip! Gzip-only-text/html
 
# Don't compress images
# SetEnvIfNoCase Request_URI \.(? : Gif | jpe? G | png) $ no-gzip dont-vary
 
# Make sure proxies don't deliver the wrong content
# Header append Vary User-Agent env =! Dont-vary
 

 
When the project is launched, optimize apache by using the second method, because you do not need to restart the apache server.

From Zeng Jiansheng's column
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.