Enable gzip compression on Apache HTTP

Apache HTTPD
mod_deflate is a module for Apache which compresses the content of each http request before sending it to the client decreasing the page load time for each request.

Proceed as follows to enable gzip compression

Note: Tested on CentOS 5.x, 6.x

1. Activate mod_filter in Apache on CentOS

2. Add to the httpd.conf

### Gzip compression
SetOutputFilter DEFLATE
FilterDeclare gzip CONTENT_SET
FilterProvider gzip inflate req=Accept-Encoding !$gzip
FilterChain gzip

3. Restart Apache

# service httpd graceful

Further reading

Module mod_filter

Leave a Comment

Your email address will not be published. Required fields are marked *