How to enable mod_deflate in apache
The mod_deflate is a very useful apache module which increase the loading speed of your websites. You can enable this module simply by rebuilding your apache by using easyapache if you have server with control panel WHM/cPanel.
Method I (Server with cPanel)
Enable mod_deflate via easyapache.
You can rebuild your apache by running the command below.
Before executing easyapache make sure that you have taken a backup of both Apache and Php conf file and also notice the current version of your apache and php. That will be helpful in your easyapache steps. Command to find the php configuration file.
# php --ini
Command to find Apache and php version.
# httpd -v (Apache) # php -v (PHP)
Do execute the easyapache carefully.
Method II (Server without cPanel)
Enable mod_deflate by editing apache conf(httpd.conf) file.
Add the following lines to configure mod_deflate in your apache configuration file.
If you want to compress only a few types, you can add the following line to the apache conf.
AddOutputFilterByType DEFLATE text/html text/plain text/xml
Restart the apache service to coplete the process,
# /etc/init.d/httpd restart Or # service httpd restart
Command to check the modules in httpd
# httpd -M
Command to check the httpd conf syntax.
# httpd -t