Enabling Gzip Compression On IIS 6

Published: {ts '2011-01-08 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/enabling-gzip-compression-on-iis-6/

GZip compression is a simple, effective way to save bandwidth and speed up your site. For anybody still using IIS6 here is a simple walkthrough of the steps required to enable it.

Step 1: Check if compression is currently Running.

Before we go further it is worthwhile to check if compression is currently turned on. A simple way of doing this is to our website through the compression check utility from the "port80.com" website. This will not only tell us if our website is using compression, but also how much your content is being compressed when you turn it on.

The utility can be found at http://www.port80software.com/tools/compresscheck.asp

Step 2: Stop IIS Running

Login to your server and complete the following actions

  1. Select IIS Manager from Administrative Tools
  2. Right click on your computer name (not on a website)
  3. Select "All Tasks" -> "Restart IIS"
  4. From the drop down, select "Stop IIS" and click ok.

Step 3: Locate and Backup the Metabase.xml

The next steps involves editing the metabase.cml file. This is an important file so we first make a backup in case we break something.

  1. Go to "c:\windows\system32\inetsrv"
  2. Copy the "Metabase.xml" file and name the copy "Metabase_backup.xml"

Step 4: Edit the Metabase.xml

Now we have the file backed up we need to edit the section in it dealing with the compression scheme.

  1. Open the metabase.xml in Notepad. Do not use other editors such as word as they will insert hiden characters which will corrupt the file.
  2. Run the find command using "IIsCompressionScheme"
  3. This returns a match which looks like this: "
  4. Here we see two nodes named "IIsCompressionScheme" and one node named "IIsCompressionSchemes" plural.
  5. Delete these nodes and replace them with the code below

Step 5: Coldfusion Extensions

This last step only applies is you are running coldfusion. In the code above is a line labelled "HcScriptFileExtensions" which lists 6 extension types dealing with asp, php etc. In order to run compression on coldfusion files add the following extensions to the list, "cfml, cfm".

HcScriptFileExtensions="aspx asmx asbx ashx axd php cfm cfml"

Step 6: Restart IIS

Repeat the steps outlined in step 2, only this time select start. Once IIS is restarted check one of the hosted site using the compression checker utility mention in step 1.

Thats it, you should now be sending gzip compressed web pages.