Using the mod_deflate
Apache module, you can compress the content of websites before it is delivered to clients. To learn more about the module, refer to the http://httpd.apache.org/docs/2.2/mod/mod_deflate.html webpage.
Note: This module is supported since CloudLinux 6
To enable mod_deflate
for all websites on a WebHosting Linux server, follow the below steps:
Make sure the mod_deflate module is enabled in the main Apache configuration file:
# grep -i deflate /etc/httpd/conf/httpd.conf LOADMODULE deflate_module modules/mod_deflate.so
and the module is loaded:
# apachectl -M | grep -i deflate [Thu Jun 07 11:02:17 2018] [notice] POA VHosts: module has registered its hooks. Syntax OK deflate_module (shared)
Edit the file
/etc/httpd/conf.d/ng_custom.conf
and add the below lines to compress the most common text-based types of files:<Directory "/var/www/vhosts"> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript </Directory>
Restart the Apache service:
# service httpd restart
Note: If you are using a WebHosting Linux cluster, carry out these steps for all nodes in the cluster
See also: