Linux Server Admin Tools and GNU Benchmark Tools Directory, OpenSource Tools

mod_deflate on cpanel

The following post discuss how to install mod_deflate on cpanel server.  Before going  through here are few advantages of having mod_deflates installed in cpanel server. 🙂

Cpanel Site optimization

1 – > Login in to whm as root ” Software -> EasyApache (Apache updates)” and select the mod_deflate modules under the apache module list page (make sure you have done a httpd.conf before proceeding further) and recompile the apache.

2 -> Once built, you need to tell it to do something. You’ll see a new icon on your sites cPanel now, called “Optimize Site”. You can enable it on a per site basis.

3 -> To enable it on all the sites running in the server, you need to edit the :

<IfModule mod_deflate.c>
AddOutputFilterByType  DEFLATE text/html text/plain text/xml

<IfModule mod_setenvif.c>
# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don’t compress images
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

</IfModule>

<IfModule mod_headers.c>
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>

This will automatically restart the apache server after saving. After restart try testing the site in the following url :

http://www.whatsmyip.org/http_compression/

Cheers!