For those of you who didn’t know, Apache’s mod_deflate is an Apache module that will compress output from your server before it is sent to the client. If you have newer version of Apache the mod_deflate module is probably loaded by default, but it may not be turned on.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step by step enable Gzip compression on Apache.
Enable Gzip Compression on Apache
Step 1. First, verify that the module is loaded in your httpd.conf file.
Your current version of Apache may already have enabled this module for you, but you may still want to be sure. To enable this module, add the following line (if it does not exist) in Apache configuration file.
Step 2. Configure httpd.conf file.
Open httpd.conf file using a text editor and place the following in it:
# mod_deflate configuration
# Restrict compression to these MIME types
# Level of compression (Highest 9 - Lowest 1)
# Netscape 4.x has some problems.
# Netscape 4.06-4.08 have some more problems
# MSIE masquerades as Netscape, but it is fine
Step 3. Restart Apache and Verify.
## CentOS ##
## Ubuntu ##
You can use this link to verify your server gzip using one of domain configured on server.
Congratulations! You have successfully Enable Gzip Compression on Apache web server. For additional help or useful information, we recommend you to check the official Apache website.