Apache enables Gzip compression settings

Source: Internet
Author: User
Step 1: Check whether the following two modules are enabled in/etc/httpd/conf/httpd. conf: LoadModule

Step 1:

Check whether the following two modules are enabled in/etc/httpd/conf/httpd. conf:

LoadModule deflate_module modules/mod_deflate.so

LoadModule headers_module modules/mod_headers.so

View method:

Cat/etc/httpd/conf/httpd. conf | grep mod_deflate

Cat/etc/httpd/conf/httpd. conf | grep mod_headers

If there is # above, you need to enable and delete it!

Enabling gzip consumes additional cpu resources

Step 2:

Add the following at the end of the apache configuration file:


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
 

Step 3:

Restart apache: service httpd restart

It is found that gzip is enabled, which is much faster:

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.