cPanel Tutorial: Enable Gzip Compression In A Few Easy Steps

I had a client request this addition and it’s not as up front or simple as it should be but a few simple steps will make it easier.

Gzip compression is used by a few web applications, such as Magento’s ecommerce shopping cart and is a requirement in some instances, so installing on cPanel can be difficult and will drive you crazy.

First step:
We enable “Deflate” by running Easy Apache. If you are familiar with Easy Apache, this will not be a problem. We click the Easy Apache button and go to the following.

Choose “Previously Saved Config” and click “Start customizing based on profile”.

Apache Version:
Choose the latest which is not END OF LIFE. For this tutorial, Apache 2.2.23 is the latest and we want to choose this then click “Next step”.

Please choose which PHP version(s) to build:
We do not want END OF LIFE or EXPERIMENTAL. For this tutorial, 5.3.17 is the latest and most stable version so we choose this and click “Next step”.

Short Options List:
You should have IonCube Loader for PHP and Suhosin for PHP enabled because most people require this at a later date. Choose both two of them and click “Exhaustive Options List”

Exhaustive Options List:
We have found our Deflate option! Click it to enable it. While we are here, you may want to consider enabling these options under PHP 5.3.17 such as Exif, GD, Mbstring, Mcrypt, PDO MySQL, and Zlib. These are common PHP requirements on most web applications and if you run a shared or reseller web hosting for individuals, they will require this one day!

Next, we click “Save and build” while we go grab a cup of coffee or take the dog for a walk around the block. Recompiling Apache and PHP takes about 10 minutes or so, depending on your system.

Second Step:

We navigate to Services Configuration >> Apache Configuration >> Include Editor >> Post VirtualHost Include, and select All Versions.

Next, we paste this:
Click here for the code to paste into this area

After we paste this, we click “Update”.

Third Step:
We login to the account of the domain we want to enable Gzip for. There will be an “Optimize Website” option now under “Software / Services” and you can enable Gzip entirely for the site, for certain file extensions, or disable it.

We have enabled Gzip globally for every domain on the server and this works because we give the user the power to maintain their account without contacting you to have this enabled.