Introduction
In Linux systems, gzip (mod_deflate) is used to compress HTTP content before it is served to the client; this results in faster network transfers. However, simply having mod_deflate enabled is not enough to have your content compressed. In addition, gzip compression does not work with the CGI PHP handler, so you must select a different PHP handler in order to use it.
Procedure
First, you will want to make sure that mod_deflate is enabled on your server:
[17:09:11 testhost root@host ~]cPs# httpd -M | grep 'deflate'
deflate_module (shared)
If it is not, you will want to install mod_deflate using the EasyApache 4 interface (WHM >> Home >> Software >> EasyApache 4).
Customize your profile, select Apache modules, find mod_deflate, and tick it on. You can then click "Review" on the left-hand side and provision the new build.
Once this is done, you will need to enable the compression by either setting the rules in an Apache include (to enforce gzip compression server-wide), or via an individual domain's .htaccess file. (If you want gzip compression for one domain only).
The following documentation should help if you want to set gzip compression globally:
In addition, the following resource from GTmetrix is useful for understanding which rules to put in place:
It is also possible to enable zlib.output_compression for Wordpress sites using a php.ini file. Navigate to the php.ini file in question (WHM >> Software >> MultiPHP INI Editor) and add the following line to the bottom of the file before saving:
zlib.output_compression = On
The following article may be helpful if you have further questions about site optimization: