Setup page compression with mod_deflate on apache 2.2 and WHM

Mod_deflate is an optional module for the Apache 2 HTTP Server. It is based on Deflate lossless data compression algorithm which uses a combination of the LZ77 algorithm and Huffman coding.

This Apache 2 module provides the DEFLATE output filter that allows output from Apache 2 HTTP server to be compressed before being sent to the client’s web browser such as Mozilla Firefox and Internet Explorer.
Enabling this Apache 2 specific module will help decrease network traffic and pages are served faster as pages are compressed on-the-fly thus reducing the size by 50 to 80 percent. It will however increase your server cpu usage as the pages are being compressed.
Below are the steps to enable mod_deflate module on apache 2.2 through cpanel/whm with the assumption that apache 2 was compiled with mod_deflate.
1. Login as root to your Web Host Manager page and go to Apache Configuration.
2. Click on the Include Editor and locate Pre VirtualHost Include and select “All versions” on the “select apache version” drop down list.


3. Copy and paste the configuration below:
<location />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css
</location>

4. Restart Apache service to enable the changes on the configuration.
To check if mod_deflate is working and Apache 2 is serving compressed pages, you can check your website from here
Spread the word
del.icio.us Digg Furl Google StumbleUpon Technorati Windows Live Yahoo! Help











Leave a Comment