Ativar Compressão gzip para todos os domínios hospedados

Categories cPanel, TutoriaisPosted on

Apache mod_deflate module is responsible for the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with older version of Apache.

If you are having only cPanel access (user interface), Then read the following article to enable Apache Gzip Compression in the account.

apache-gzip-test

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

You must have WHM root credentials for making changes globally. Let’s Login to your WHM dashboard like

https://11.22.33.44:2087/

Step 2 – Edit Pre VirtualHost Apache Configuration

Navigate to the following location in WHM dashboard

Home » Service Configuration » Apache Configuration » Include Editor

and edit Pre VirtualHost Include (All versions) as per below screenshot.

cpanel-apache-pre-virtualhost

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.

 

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *