• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

securitywing

How to Check and Enable Gzip Compression in CentOS for WordPress?

by wing

Gzip compression is used to zip or compress webpages in the webserver before serving it to the users’ web browser. Thus it saves network bandwidth because the server sends the compressed form of your webpage over the network. Another advantage of Gzip compression is faster page loading time. When the users’ machines receive the compressed format of webpages, it only takes a few milliseconds to decompress it.

gzip compression

 

How to check if Gzip is enabled in my server?

Before enabling Gzip for WordPress, you need to make sure that the server is ready to serve compressed files in CentOS. The   mod_deflate is a module that allows the server to compress the files in the server before delivering the page to the client machine.

By default mod_deflate modules are enabled in Apache. To make sure check following line in Apache configuration file /etc/httpd/conf/httpd.conf.

LoadModule deflate_module modules/mod_deflate.so

Debian based users can enable Gzip module (mod_deflate) using following command.

$ sudo a2enmod deflate

To confirm if mod_delfact in installed in CentOS you can use the following command

apachectl -M |grep deflate

To check if the mod_deflect is enabled run the following command:

curl -I -H ‘Accept-Encoding: gzip,deflate’  http://yoursite.com

Note: replace the http://yoursite.com by your website’s URL.

If you see “Content-Encoding: gzip” in the output of the above command, it means  that module is active. If you don’t see “Content-Encoding: gzip” in the output, you need to activate it by creating a file named  deflate.conf file in the /etc/httpd/conf.d/ directory. After creating the file add the following lines in /etc/httpd/conf.d/deflate.conf

 

<ifmodule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript

DeflateCompressionLevel 8

</ifmodule>

 

Next, reload the apache server

service httpd reload

Finally run the command to check the status of the module.

# curl -I -H ‘Accept-Encoding: gzip,deflate’ http://yoursite.com

The last step is to create a .htacess file in the root directory of WordPress if it is not already created. If your WordPress installation already has a .htaccess file, you need to add the following codes at the end of the file. Do not remove anything that is already in the .htaccess file required by the WordPress.

 

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

 

 

List of useful web tools to verify if Gzip compression is enabled:

  • https://varvy.com/tools/gzip/
  • https://checkgzipcompression.com/
  • http://www.whatsmyip.org/http-compression-test/
  • https://gtmetrix.com/

If you want to test from WordPress dashboard to test Gzip compression status, you can install “Check and Enable GZIP compression” plugin. This plugin will give you information on whether Gzip is enabled in for your website.

Remember that enabling Gzip in the server does not mean that your pages will be Gzip compressed. Don’t forget to add the required codes in .htaccess file to tell WordPress to compress the pages.

Related posts:

  1. Exchange Server 2003 Tutorial
  2. Windows DNS Server Configuration
  3. Types of Virtualization Technology-Advantages vs. Disadvantages
  4. How to Configure SNMP in Zabbix Server (Debian) to monitor Cisco Switches

Filed Under: Tutorial Tagged With: gzip

Primary Sidebar

Please help us sharing

Categories

  • AWS
  • Basics
  • Containers
  • Cryptocurrency
  • Cyber
  • Internet Security and Safety
  • IS Audit
  • IT Security Exams
  • Law & Human Rights
  • Network Security Tips
  • Off Track
  • Social Media Governance
  • Tech Comparisons
  • Tech Stack Suitability
  • Telecom
  • Tutorial

CISSP Sample Test

Take a CISSP Sample Test

CISA Sample Test

CISA IT governance Sample test

Please Follow Us

Contact us for Ads

Go to Contact Form

Search

Footer

Copyrights

Protected by Copyscape Duplicate Content Detection Software

Securitywing.com reserves the copyrights of all of its published articles.No contents of this site is permitted to be published to anywhere else in the Internet.If any contents are found in any other websites, securitywing reserves the rights to file a DMCA complaint. But you have the right to use the link of any relevant article of this site to point from your website if you consider that it might improve the quality of your article.

Tags

audit AWS backup basics browser check cisco cloud computer configuration cyber data database email gmail hsrp ids iis informaiton internet kubernetes linux load balancing malware microsoft network protection redundancy risk router security security tips server social media SSL switch test tools vpn vrrp web webserver website windows wordpress

Copyright © 2010-2025 ·All Rights Reserved · SecurityWing.com