Enabling Gzip Compression can speed up your website. Faster websites make visitors happy. This guide will show you how to enable Gzip Compression in WHM globally. It’s simple and quick.
What is Gzip Compression?
Gzip Compression reduces the size of your website files. Smaller files load faster. It compresses HTML, CSS, and JavaScript files. This makes your website faster and more efficient.
Step 1: Install mod_deflate Module
1. Log in to WHM
2. Go to EasyApache 4
3. Customize Profile
4. Find the mod_deflate module and enable it.
5. Review the changes you’ve made. Click the “Provision” button to complete the process.
Step 2: Enable Gzip Compression
1. Navigate to Home » Service Configuration » Apache Configuration » Include Editor
2. Edit Pre VirtualHost Include (All versions) as per shown in below screenshot:
Keep in mind that you may find this section blank with no previous code or config.
3. Update Pre VirtualHost: Append the below configuration to the Pre VirtualHost editor and save it. Don’t overwrite any existing configuration, that are added for other purposes.
<IfModule mod_deflate.c> # Insert filter SetOutputFilter DEFLATE <IfModule mod_setenvif.c> # 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 # Don’t compress images SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary </IfModule> <IfModule mod_headers.c> # Make sure proxies don’t deliver the wrong content Header append Vary User-Agent env=!dont-vary </IfModule> </IfModule>
4. Save the changes and restart Apache button will appear. Restart Apache service to apply all changes.
This is how you can enable Gzip Compression globally for all website hosted in the WHM panel. Now go to this link and check one of the domains hosted on your server if it is working or not. If everything is configured properly as per our guideline, Gzip should be enabled.