| How to Setup IIS GZip Html Compression for Dynamic Content Such as PHP ASP.NET Javascript etc |
|
|
|
|
This article has been taken from : http://www.dotnetjunkies.ddj.com/Article/16267D49-4C6E-4063-AB12-853761D31E66.dcik It is meant as internal reference for setting up our servers with Http Compression (in case the link dies at some point). I have run in to a few situations where this is beneficial but I could not get this to work for php nor for the files that I wanted to compress such as Javascript files and Css files. HTTP Compression is a wonderful technology that accomplishes a lot of different things. It allows faster page serving to clients and lower server costs due to lowered bandwidth (these two being enough for me to implement). There are a handful of articles out there that explain how to implement HTTP Compression in Internet Information Server (IIS) 6.0, but I haven’t been able to find a nice step-by-step article, so I decided to set one up. In this how-to, I’ll briefly explain what HTTP Compression is and how it works in IIS 6.0, and then provide step-by-step instructions on how to implement it because it’s not as simple as flipping a switch. In fact, there are many things in multiple places on the server you have to properly configure to implement HTTP Compression. What Is HTTP Compression?
HTTP Compression is when a Web server receives a request for a file and instead of just serving the file to the client, it checks to see if the client browser (or application) is "Compression Enabled". If so, the Web server does a check on what type of file is being requested (this is determined by the file’s extension). If the file is marked as a static file, such as an HTML file, IIS will check the Compression Cache Temporary Directory. Tip: To find the Compression Cache Temporary Directory, open up IIS and right-click on the Web Sites node and go to the Service tab. There is a text box that has a label next to it marked Temporary Directory, although it may not yet be enabled. If a compressed version isn’t found, IIS will send an uncompressed version of the file to the client and a compressed version is placed in the temporary directory (IIS will only serve to the client from the temp directory). If the compressed version is found, IIS will send the file directly to the requesting client. If the requested file is a dynamic file, such as an ASP.NET Web form, then the response is dynamically compressed and sent to the requesting client (no temp directory access is ever done). Enabling HTTP Compression on your Windows 2003 Server There are quite a few steps to enabling HTTP Compression on your server. If you follow the steps in this article, you shouldn’t have any issues. First, open up IIS and right-click on the Web Sites node and go to Properties. Click on the Service tab. As shown in FIGURE 1, you’ll see two options: Isolation mode and HTTP compression. If the Run WWW service in IIS 5.0 isolation mode check box is checked, IIS will run almost exactly like IIS 5.0. This means you won’t be able to take advantage of things such as Application Pools, which in my opinion are worth the upgrade to IIS 6.0 by themselves. We’ll utilize the options within HTTP compression in this article:
Next, go to the Web Service Extensions node. Right-click in the right pane, and click Add a new Web service extension. The New Web Service Extension dialog box appears, as shown in FIGURE 2. You can enter any name for the extension, but what others, including myself, recommend is HTTP Compression.
FIGURE 2: The Web Service Extension dialog box Click on Add. Choose C:\WINDOWS\system32\inetsrv\gzip.dll (your path may be different, but that is doubtful), and click OK. Check the Set extension status to Allowed check box, and click OK. IIS 6.0 Metabase Configuration - MetaBase.xml
Open up Windows Explorer and go to C:\Windows\System32\inetsrv. Find MetaBase.xml and make a copy (you can just highlight it and do a Ctrl-C, then a Ctrl-P to make a copy of MetaBase.xml). Now open up MetaBase.xml in a text editor. Find the Location ="/LM/W3SVC/Filters/Compression/gzip" Look for the HcScriptFileExtensions section. Your default should have: asp, dll, and exe. This is where you add any extensions you want to compress for dynamic files. In my case, I added aspx. You’ll notice many other attributes in FIGURE 3. These are the ones I find most important:
|
| < Prev | Next > |
|---|








