Wednesday, January 27, 2010

Howto: enable HTTP Compression

How to enable HTTP Compression? In order to enable compression, you will need compression modules compiled with Apache. Apache 1.x needs mod_gzip and Apache 2.x need mod_deflate compiled with it.

If you have these module installed, you need to edit your Apache configuration file locate at “/etc/httpd/conf/httpd.conf” file and add the following lines to it:


SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary


Save the file and restart the httpd service. This will compress all the files except the .gif, .jpe, .jpeg and .png files.

No comments:

Post a Comment