If your server and website are not using HTTP Compression, you're not taking advantage of one of the easiest website performance features to implement. This blog tells you how to enable HTTP Compression in less than 10 minutes and reduce traffic by as much as 85%! The instructions below are a combination of articles I've read online and in print. We have implemented this on at least a dozen servers which host hundreds of websites with only one issue (mentioned below; issue with PDFs).
Create Compression Folder
- Create a folder where the compressed file will be cached. You can give it any name or leave the default: "%windir%\IIS Temporary Compressed Files".
- Grant write permissions to IUSR_{machinename} for the folder.
Enable Compression in IIS
- In IIS, right-click on the "Web Sites" node and click "Properties".
- Select the "Service" tab.
- Check "Compress application files". (we have seen issues where PDFs are compressed and cannot be opened)
- Check "Compress static files".
- Change "Temporary directory" (if you created your own folder).
- Set the "Maximum temporary directory size" to something that the hard drive can handle (i.e. 1024).
- Save and close the "Web Site" Properties.
Create a Web Service Extension (WSE)
- In IIS, select "Web Service Extensions".
- Add a new web service extension.
- Name it "HTTP Compression".
- Point it to "c:\windows\system32\inetsrv\gzip.dll".
- Check the "Set extension status to Allowed" to enable it.
Edit IIS Metabase
- In IIS, right-click on the server node (top level) and click "Properties".
- Check "Enable Direct Metabase Edit".
- In Notepad, open the metabase: C:\Windows\system32\inetsrv\metabase.xml
- Search for "<IIsCompressionScheme"
- There will be two of them, one for deflate and one for gzip.
- In "HcScriptFileExtensions", add aspx, asmx and any other extension that you need to the list already there. Do this for both deflate and gzip and format the format.
- Change "HcDynamicCompressionLevel" to 9. Do this for both deflate and gzip.
- Restart IIS