How to Enable mod_deflate GZIP Compression on cPanel

Posted: 0p in cPanel
Tags:

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.

+++++++++++++++++++++++++++

SetOutputFilter DEFLATE

# 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 .(?: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

DeflateCompressionLevel 9

+++++++++++++++++++++++++++

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

text/html
text/plain
text/xml
text/css
text/javascript
application/javascript
application/xhtml+xml
application/xml
application/rss+xml
application/atom_xml
application/x-javascript
application/x-httpd-php
application/x-httpd-fastphp
application/x-httpd-eruby
image/svg+xml

Reference:

http://www.sherin.co.in/how-to-enable-gzip-compression-in-cpanel-server-via-mod_deflate-and-apache/
—————————————————————–>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s