Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Control Panel»How to Enable Gzip Compression in cPanel/WHM Globally

    How to Enable Gzip Compression in cPanel/WHM Globally

    By RahulAugust 17, 20212 Mins Read

    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.

    Advertisement

    The users with cPanel access only can also enable the Gzip compression. Follow our other article to enable Apache Gzip Compression in cPanel only account.

    The users with root access can use the WHM panel and enable Apache mod_deflate globally for all cPanel users. Let’s follow the below steps to enable apache Gzip compression (mod_deflate) for all cPanel accounts.

    Step 1 – Login to WHM Panel

    You must have the root credentials of your system to get access to the WHM panel. It is required to make changes globally in a cPanel server. The default WHM is accessible on 2087 (SSL) and 2086 (non-SSL) ports.

    Open a web browser and access the WHM Panel:

    https://11.22.33.44:2087
    

    Login with the administrator (root) account.

    Step 2 – Edit Apache Pre VirtualHost

    You need to added your settings in Pre section of Virtualhosts. So it will be loaded by the all Virtualhost in server. Let’s navigate to the below location in WHM:

    Home » Service Configuration » Apache Configuration » Include Editor

    Edit Pre VirtualHost Include (All versions) as per shown in below screenshot:

    cpanel-apache-pre-virtualhost

    You may get this box empty for previously added settings.

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

    The above configuration has been taken from Here. So read this article carefully before implementing it.

    Save the changes and you will get a restart Apache button. Restart Apache service to apply all changes.

    Conclusion

    In this tutorial, you have learned to enable Gzip compression server-wide (globally) on a WHM/cPanel server. Now, use this link to verify your server gzip using one of domain configured on server.

    Apache compression cpanel gzip
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Comparing Apache MPM Worker and Prefork: Which is Right for Your Application

    How to Install Apache (httpd) on RHEL & CentOS Stream 9

    How to Install LAMP Stack on RHEL & CentOS Stream 9

    View 32 Comments

    32 Comments

    1. David Oviedo on May 15, 2020 11:56 pm

      Excelente aporte, muchas gracias.

      Reply
    2. Mehmet on February 4, 2020 10:52 pm

      Thank you 🙂 Noticeable speed

      Reply
    3. John Wilkins on June 11, 2019 4:16 pm

      Worked perfectly, Thanks!!!

      Reply
    4. cemal on June 30, 2018 2:43 pm

      It works thank you

      Reply
    5. Pinoy Tambayan OFW on December 9, 2017 2:12 am

      Good post. I learn something new and challenging

      Reply
    6. Bjorn on December 4, 2017 8:55 am

      Thank you for the good article!! It saved me quite some httpd.conf fiddling!

      Reply
    7. Diego on November 2, 2017 2:03 pm

      great article! thanks for sharing!

      Reply
    8. OCS on October 6, 2017 10:36 pm

      I actually never comment on such things but this is absolutely amazing.
      So easy and works so perfectly…

      Reply
    9. Shlomi on October 1, 2017 11:42 pm

      This Wes very easy… Thanks!

      Reply
    10. Kasam Drama on September 26, 2017 1:20 am

      This is very nice tutorial, Thank you for sharing with us 🙂

      Reply
    11. visit website on September 15, 2017 8:29 am

      Awesome, works on CentOS 7.3 with WHM 64.

      Reply
    12. Asmaul Husna on August 15, 2017 1:26 am

      nice article, you save my day : )

      Reply
    13. Danie on June 30, 2017 2:27 am

      Awesome, works on CentOS 7.3 with WHM 64.

      Thank you!

      Reply
    14. Pinoy Network on June 2, 2017 10:21 am

      Thank you Rahul that’s work for me. Keep sharing such type of Knowledge 🙂

      Reply
    15. James Mworia on May 19, 2017 2:56 pm

      Thanks for the information.I had been looking for way to compress content on my website and this by far is the easiest and best.

      Reply
    16. Owais on May 5, 2017 12:19 pm

      Nice Information, Its Working my WHM.

      Thanks

      Reply
    17. Laura Remy on April 27, 2017 6:52 pm

      This is very easy! Thanks. I’ve ready in other site using EasyApache but not as easy as this

      Reply
    18. Muhyudin on March 18, 2017 6:11 pm

      Very Good Article And it works for me
      Thank you

      Reply
    19. DramaCool on December 23, 2016 6:07 am

      Thank you very much.

      Reply
    20. fira on November 17, 2016 6:23 am

      wow is so nice article, and worked for me, thanks

      Reply
    21. Raydez on July 29, 2016 2:33 pm

      I cannot thank you enough. It actually works beautifully. You have also explained it in such a easy implementable way. Setting it up was a breeze. I looked for this information earlier also, but couldn’t find anywhere on the net. But I guess I got lucky this time. Just implementing this increase speed up by 10%.

      Reply
    22. Resep Masakan on July 21, 2016 12:33 pm

      Thanks for this tutorial.
      It very helpful for Me.

      Reply
    23. UnPoo on June 20, 2016 12:17 am

      Very very thx “tecadmin.net”.

      Reply
      • Badtameez Dill on November 17, 2017 7:59 pm

        I am so grateful for your post .Really looking forward to read more. Keep writing.

        Reply
    24. Stephen Forde on June 10, 2016 2:27 am

      This was too easy. Thanks

      Reply
    25. Jose Philip Raja on January 23, 2016 10:12 am

      Saved lots of Gigabytes worldwide!! 😉 Thanks mate!

      Reply
    26. Jasa SEO on December 7, 2015 2:32 pm

      hi,

      nice tutorial, thanks for info

      Reply
    27. EvilProgrammer on October 18, 2015 11:49 pm

      This thing works very well, thanks alot..

      Reply
    28. Irwansyah Daulay on June 17, 2015 10:19 pm

      Thank you for the tutorial…:)

      Reply
    29. Dewi on June 13, 2015 6:16 am

      This is very easy! Thanks. I’ve ready in other site using EasyApache but not as easy as this

      Reply
    30. Charles on November 17, 2014 11:52 pm

      Great thanks for posting

      Reply
    31. Web Phil on July 25, 2014 1:21 am

      Thank you for this! We have rolled out this globally with our servers! With Deflate sites looks to be working better and faster.

      Thanks!

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.