KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to Enable Apache Gzip Compression (mod_deflate) in cPanel ?

Category: cPanel
Tags: # # #

Enabling Gzip compression is one of the starting points of optimizing web pages’ delivery optimally. It also increases website performance and may land your website in the green zone of google page speed insight. Let’s learn, How to Enable Apache Gzip Compression (mod_deflate) in cPanel ?


How to check Gzip Compression status?

By default, Gzip compression comes installed on the cPanel/WHM server. Still, if you want to check whether the Gzip compression (mod_deflate) is installed on the server or not; run the following command,

httpd -M | grep 'deflate'

The result should look like,

[root@158-106-130-242 ~]# httpd -M | grep 'deflate'
 deflate_module (shared)

If you’re not able to see the expected result as above, then you can install Gzip (mod_deflate) using WHM >> Home >> Software >> EasyApache 4 interface or run the following command to install mod_deflate on cPanel/WHM server,

yum install ea-apache24-mod_deflate -y

Enable Gzipp Compression (mod_deflate)

1. Log in to cPanel using Username Password. i.e; (https://yourdomain.com:2083 or https://yourdomain.com/cpanel)

2. Navigate to Software → Optimize Website.

navigate to enable gzip optimize website cpanel

3. Choose the preferred option,

Disabled: To disable the compression.

Compress All Content: To compress all the supported content/files.

Compress the specified MIME types: To compress specified files (Ex: text/html text/plain text/xml)

For this article, we will go ahead with Compress All Content.

select the gzip compression option cpanel

4. Finally, click on Update Settings.

Enable Apache Gzip Compression (mod_deflate) in cPanel

Extras: 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

Conclusion

Now that we’ve gone over how to enable apache GZip compression (mod_deflate) on the cpanel control panel. If you’re not able to track down whether the Gzip compression is enabled or not, refer to this article: How to Check Whether Gzip Compression is Working? or get in touch with our support.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team is ready to help you with requests such as creating MySQL databases and users, should you need our assistance. You’re not using KnownHost for the best web hosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your web hosting experience.