How to enable http compression on a Plesk server?
First of all, what is http compression and which module to use for http compression? Compressing data before transmitting to the browsers and then uncompressing the data before displaying. The module that is responsible for http compression i.e. compressing the data is called mod_deflate.The main advantage is that it saves a lot of bandwidth.
On a Plesk server, the mod_deflate module is installed by default, however it may be disabled in the Apache configuration file. To enable the module edit the Apache configuration file
Search for the line
#LoadModule deflate_module modules/mod_deflate.so
and uncomment it i.e. remove the ‘#’ mark
LoadModule deflate_module modules/mod_deflate.so
Save the file and restart the httpd service
service httpd restart
Now, create a .conf file under the /etc/httpd/conf.d/ directory since Apache reads all the .conf files from that directory on a Plesk server
and place the following code in it
.(?:gif|jpe?g|png)$ no-gzip dont-vary
Save the file and restart the httpd service. The compression code will compress all the files except the .gif, .jpe, .jpeg and .png files. To test the compression, use the tool
To enable compression for a specific directory or domain, specify the directory path in the <Location> directive in deflate.conf and restart the Apache server.
Enable http compression on a Plain Linux server