Live Help

Email

Client portal

VPS Service

Enable Apache Gzip Compression (mod_deflate) Globally in WHM/cPanel

 May 11, 2016     0 Comments

If you have root access of WHM, you can enable Apache mod_deflate globally in WHM for all cPanel users. This article will help you to do so. If you are doing or existing server, you may read and understand about its working and impacts on running sites. Follow the below steps to enable apache gzip compression ( mod_deflate ) settings for all cPanel accounts.

Step 1: Login to WHM Panel 

For making changes globally, its necessory to have WHM root access. Login to your WHM system

https://11.22.33.44:2087/ 

Step 2: Edit Apache Configuration Pre VirtualHost 

Navigate to following location in WHM

Home » Service Configuration » Apache Configuration » Include Editor

and edit Pre VirtualHost Include (All versions)

Step 3: Update Pre VirtualHost 

Add the following settings in Pre VirtualHost editor and update it. Below settings has been taken from Here. So read this article carefully before implementing it.

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

Step 4: Restart Apache and Verify 

After updating settings in Apache , it will show an restart Apache button. Restart Apache service to complete the setup. You can use this link to verify your server gzip using one of domain configured on server.


How helpful was this article to you?

Posting has been disabled.

cPanel Partner NOC