Compiling Apache with mod_deflate Module
To verify, run httpd -t -D DUMP_MODULES command on the server, and look for deflate_module (static)
Create a file /usr/local/apache/conf/includes/post_virtualhost_2.conf and place the following code in it.
# 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 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 .(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
Save the file and restart Apache service.
Enable GZIP Compression on Per Account Basis
Login to cPanel account for the user account which GZIP compression wants to be turned on. Then click on Optimize Website under Software / Services.
Then choose compress all content or compress the specified MIME types. A text box to specify file types to compress is selected (default is text/html text/plain text/xml).
Tip: Possible MIME types include