Page 1 of 1

How to setup GZip Compression in IIS

Posted: Tue Dec 22, 2009 2:23 am
by Neo
By using compression for static web files will make faster downloads for the users. IIS can gzip on javascript and css files.
  1. Enable HTTP Compression
    1. Open IIS Manager
    2. Right-click "Web Site" and select "Services" tab.
    3. Check "Compress Static Files"
    4. Click "Ok"
  2. Specify that "js" and "css" file should be compressed by changing the metabase. By default, IIS 6.0 is set up to compress htm, html, and txt files.
    1. Open a command prompt
    2. cd to C:\Inetpub\AdminScripts (assuming the default location)
    3. run this command (you can change the list of extensions, but only specify static, compressible files here):

      Code: Select all

      cscript.exe adsutil.vbs set w3svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "js" "css"
  3. Restart the World Wide Web Publishing Service
More detailed information about setting up different compression for different sites, compressing dynamic pages, etc... can be found here.