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

securitywing

Menu
  • About
  • Must Read
      • IIS Performance Boost
      • RFID Security
      • Web App Security Testing
      • How to Secure Home Network
      • Prevent Cross-Site Scripting Attacks
      • Renew Self-Signed Certificates
      • Penetration Testing Tools
      • VPN Concentrator
      • Forensic Investigation Tools
      • Digital Certificates
      • Cloud Security Issues
      • Advanced Evasion Prevention
      • Firewall Types
      • Tips to Prevent Data Exfiltration
      • Classified Info Handling
      • MySQL Security
      • Definition of 7 Types of Malware
      • VOIP Security
      • Why Antivirus Software Fails
      • 15 Network Security Vulnerabilities
      • Web App Security
      • IT Security Standards
      • Types of Virtualization
      • Android Security
      • Digital Signature
      • Advanced Malware Protection
    • Close
  • Consultancy
  • Contact

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:

  • No Related Posts

Filed Under: Tutorial Tagged With: gzip

Primary Sidebar

CISSP Sample Test

Take a CISSP Sample Test

CISA IT governance Sample test



Twitter Follow @securitywing

Categories

  • AWS
  • containers
  • Internet Security and Safety
  • IS Audit
  • IT Security Exams
  • Network Security Tips
  • Off Track
  • Telecom
  • Tutorial

Pages

  • About
  • Best IT Security Certification Exam
  • CISA IT governance Sample test
  • CISA Sample Test
  • CISSP Sample Test Online
  • Consultancy
  • Contact

Popular Posts

  • 3 Steps to Install Miniku...
  • How to install a new Goda...
  • 63 Web Application Securi...
  • How to Setup AWS CloudFro...
  • How to Renew Self-Signed...
  • Host Based IDS vs Network...
  • 8 Effective Ways to Impro...
  • Active vs Passive FTP Mod...
  • Top 10 RFID Security Conc...
  • 3 Simple Steps to Capture...

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

antivirus audit AWS backup browser check cisco cloud computer cyber data database encryption firewall home hsrp ids informaiton internet intrusion it kubernetes linux load balancing malware network protection putty risk router security security tips server ssh SSL switch tools virus vpn vulnerability web webserver website windows wordpress

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