Wednesday, September 06, 2006
Installing mod_gzip for Apache can help reduce bandwidth costs. mod_gzip is an Apache extension that uses Gzip to reduce the size of your webpages. It can reduce the size of a webpage by as much as 80% in some cases I have seen. Setting it up is also very easy.
How Do I Install mod_gzip?
1) Download mod_gzip from Sourceforge. You will see several files available. If you are running Apache on Windows, download ApacheModuleGzip.dll.zip
2) Unzip the ApacheModuleGzip.dll into your modules folder. Your modules folder can be found under your Apache installation.
3) Backup httpd.conf as httpd.conf.bak. Open up httpd.conf and insert the following at the very end of the file. (Note: This is very important!)
LoadModule gzip_module modules/ApacheModuleGzip.dll
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include mime text/.*
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.php3$
mod_gzip_item_include mime "application/x-httpd-php.*"
4) Restart Apache. Test if your code is working by by visiting Leknor's gzip tester. Enter your the URL of you homepage into the box and click Test. If it says your URL is gziped, then Bingo! You're on your way to saving big money on your bandwidth bills!