Apache how to turn on gzip compression

Source: Internet
Author: User

1. Locate/etc/httpd/conf/httpd.conf (under Linux) and open

2. Locate the Deflate_module and Headers_module modules in the file and remove the previous #

3. Add at the bottom of the file

<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. (?:p df|doc) $ no-gzip dont-vary
Addoutputfilterbytype DEFLATE text/html text/plain text/xml text/css
Addoutputfilterbytype DEFLATE Application/x-javascript
</IfModule>

This piece of code

4. Restart the Apache Server (service httpd restart).

Apache how to turn on gzip compression

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.