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 is called mod_deflate.The main advantage of mod_deflate is that it saves a lot of bandwidth and loads the pages faster.

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 mod_deflate module in Plesk edit the Apache configuration file

PHP Code:
# vi /etc/httpd/conf/httpd.conf 
Search the line that says,

PHP Code:
    #LoadModule deflate_module modules/mod_deflate.so 
and uncomment it i.e. remove the ‘#’ mark

PHP Code:
    LoadModule deflate_module modules/mod_deflate.so 
Now, create a /etc/httpd/conf.d/deflate.conf file. Apache reads all the .conf files from the /etc/httpd/conf.d directory on a Plesk server.

PHP Code:
    # vi /etc/httpd/conf.d/deflate.conf 
and place the following code in it

PHP Code:
    <Location />
    
SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI  
\
    \.(?:
gif|jpe?g|png)$ no-gzip dont-vary
    
</Location
Save the file and restart Apache.

PHP Code:
    # service httpd restart 
This compression code will compress all the files except the .gif, .jpe, .jpeg and .png files before sending them to the browser. To test the compression, use the tool

[Only Registered and Activated Users Can See Links. Click Here To Register...]

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.