Apache’s mod_deflate is an Apache module that will compress output from your server before it is sent to the client. If you have newer version of Apache the mod_deflate module is probably loaded by default, but it may not be turned on. To check if compression is enabled on your site, first verify that the module is loaded in your httpd.conf file:
LoadModule deflate_module modules/mod_deflate.so
Then you can use to following web based tool to verify compression:
For my server, CentOS 6.x, the module was loaded by default but compression was not on until I set up the configuration file. You can place your compression configurations into your httpd.conf file, an .htaccess file, or a .conf file in your httpd/conf.d directory. My base configuration file is as follows:
Another thing to consider is that while the gzip compression algorithm is fast and efficient for smaller text files, it can be cumbersome on your CPU when trying to compress larger files. Be wary when adding compression to non text files > 50 KB.
When you examine the HTTP headers of your server’s response, you will see the following headers for compressed content:
Content-Encoding: gzip Vary: Accept-Encoding
Here is another default configuration file taken from Ubuntu 12.10: