Apache2 for Windows can make the job of sending content as a Gzipped file a little tricky; but here is how to do it.
The first step is to make sure you have the mod_gzip.so file in your modules folder. If you don't then you should download it. I'd recommend downloading the file from GKNW. In this archive of Apache 2 modules you'll want to find the latest version of mod_gzip and download it. Once you've got it downloaded, extract it, and copy the mod_gzip.so file from the Release folder into your own Apache2 modules folder.
Now that the file you need is in place you can now change you httpd.conf file to tell it what to GZip, and that Gzip should be used. Inside it you should add something along the lines of:
LoadModule gzip_module modules/mod_gzip.so
<IfModule mod_gzip.so>
mod_gzip_on Yes
mod_gzip_item_include file \.php
mod_gzip_item_include mime text/.*
mod_gzip_item_exclude mime ^text/css$
mod_gzip_command_version mod_gzip_version
mod_gzip_dechunk yes
</IfModule>
This little block of code when added will tell Apache to load the mod_gzip module, and if it's loaded it successfully it will then turn mod_gzip on, and tell it what files to include. By using "mod_gzip_item_include file" we're telling it to include a specific file(s) in what is GZipped - in this case all PHP files should be sent to the browser in a GZipped format. The next line then says that any files that have a MIME type of text/* (meaning any MIME type starting with text) should also be compressed. In this example I've decided I don't want CSS files to be sent back compressed so I have excluded them by using the "mod_gzip_item_exclude" directive. One thing you should remember here is that the MIME types and filenames are both handled using regular expressions. You should be able to compress and send pretty much anything to Mozilla or Opera, though Internet Explorer has issues with some filetypes such as PDF so it is best to try and stick to scripts, html (inclusive of PHP), and images.
The directive mod_gzip_command_version is used to tell the browser whether mod_gzip is allowed. This can have the following values:
- mod_gzip_status
- "mod_gzip is available" / "mod_gzip is not available"
- mod_gzip_version
- Displays the version, e.g. "2.0.53"
- mod_gzip_on
- "Yes" / "No"
The last directive used there, mod_gzip_dechunk, is used to allow the joining of chunks into one compressible packet that can be sent back to the browser. Although not used in the example, you can also use mod_gzip_handle_methods to limit the GZIP compression to requests made using certain methods such as GET or POST.
Directives added for mod_gzip can be used in the context of httpd.conf as a complete server scope as I have advised here, or it can be limited to being inside a Virtual Host, a Directory, or a .htaccess file. If you've done it inside the httpd.conf as suggested you will need to restart Apache.














According to this article on the Yahoo Developer Network
High Performance Web Sites: Rule 4 - Gzip Components
http://developer.yahoo.net/blog/archives/2007/07/high_performanc_3.html
If you use Apache, the module configuring gzip depends on your version:
Apache 1.3 uses mod_gzip while
Apache 2.x uses mod_deflate.