GZIP compression has serious impact on performance and your website loading time. In order to use it make sure that mod_deflate and mod_filter are enabled.
First create new file that will contain GZIP settings for Apache:
sudo vi /usr/local/apache2/conf/extra/httpd-deflate.conf
Paste there following content and save the file:
<IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE application/ecmascript AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml </IfModule> </IfModule>
It will add GZIP compression to most popular file types such as HTML, CSS, JS etc. If you need anything else that requires compressing, simply add more MIME types.
Now you need to include it to main Apache configuration. so open httpd.conf and Include httpd-deflate.conf.
vi /usr/local/apache2/conf/httpd.conf and make sure the following line is added.
Include conf/extra/httpd-deflate.conf