HTTP compression implementation (IIS6) (translated from Microsoft Knowledge Base)

Source: Internet
Author: User
Tags website performance

You can enable HTTP compression server-wide or on a specific directory. Http compression improves bandwidth utilization and speeds up Web site performance. In addition, you can compress static or dynamic responses.

You can enable HTTP server-side compression to increase your bandwidth utilization and accelerate your website performance. In addition, you can also choose whether to compress dynamic or static response packages.

One thing you cannot ignore is that all of the following operations must be performed under an account with administrator permissions.

 

Procedure:

1. Click "IIS", "website", "properties", and "service", and select "Zip application ".Program(Enable compressed dynamic files), select the check box to compress the static folder location. Here are some notes: Enable compression of dynamic files, that is, compressed dynamic files such as aspx and ASP, but each compression is real-time, so the CPU usage on the server is very large. It is not recommended. To Compress static files, IIS only needs to compress static files once and save them to the folder you just specified. Once a static file is compressed, It is cached in this temporary directory until it expires, or the content changes. the directory must be on the local drive of an NTFS-formatted partition. once the static file is compressed, It is cached in the Temporary Folder until it expires and the content changes. In addition, the disk where the folder is located must be in the NTFS format.

 

Under maximum temporary directory size, click a folder Size Option. if you specify a maximum size under limited to (in megabytes) (the default setting is 95 MB), then when the limit is reached, IIS automatically cleans up the temporary directory by applying the "least recently used" rule.

If the maximum file size is specified, if the maximum size is reached, IIS will automatically clear the Temporary Folder. The clear principle is least recently used "rule, the minimum number of recently used locations is cleared.

 

To enable global HTTP compression by using adsutil. vbs

 

1. Open a command prompt.

 

2. To enable dynamic compression, type the following at the command prompt and then press Enter:

 

Cscript adsutil. vbs set w3svc/filters/compression/parameters/hcdodynamiccompression true

 

3. To enable static compression, type the following at the command prompt and then press Enter:

 

Cscript adsutil. vbs set w3svc/filters/compression/parameters/hcdostaticcompression true

 

 

To enable global HTTP compression, use adsutil. vbs. Which is not recommended or preferred.

1. Open the command window,

2. If dynamic compression is enabled, type the following command parameters and press Enter:

Cscript adsutil. vbs set w3svc/filters/compression/parameters/hcdodynamiccompression true

3. Enable Static Compression. type the following command and press Enter:

Cscript adsutil. vbs set w3svc/filters/compression/parameters/hcdostaticcompression true

 

 

 

To enable HTTP compression for individual sites and site elements

To provide HTTP compression for individual websites or website elements, perform the following steps:

1. to enable Static Compression for only a single directory, first disable Global static compression (if it is enabled) and then enable Static Compression at that directory. for example, to enable Static Compression for a directory at http://www.contoso.com/Home/StyleSheets, perform the following steps:

1. Enable a Single Static Compression folder. First, check whether global static compression is enabled. If so, disable it. Then, enable Static Compression for a folder. For example, the following example is to enable Static Compression for the http://www.contoso.com/Home/StyleSheets folder, follow these steps:

1.

Disable Global static compression by executing the following command at a command prompt:

 

1. Disable global compression. Run the following command in the command prompt,

Adsutil set w3svc/filters/compression/parameters/hcdostaticcompression false

 

1.

Enable Static Compression at this directory by executing the following command at a command prompt:

Enable Static Compression for a folder and run the following command in the Command window:

 

Adsutil set w3svc/1/root/home/stylesheets/dostaticcompression true

 

2. to disable Static Compression for only a single directory, first enable global static compression (if it is disabled) and then disable Static Compression at that directory. for example, to enable Static Compression for a directory at http://www.contoso.com/Home/StyleSheets, perform the following steps:

2. Disable Static Compression for a folder. The first step is to enable global Static Compression and disable Static Compression for a file. perform the following steps:

1.

Disable Global static compression by executing the following command at a command prompt:

1. Disable Global static File compression and run the following command:

 

Adsutil set w3svc/filters/compression/parameters/hcdostaticcompression true

 

1.

Enable Static Compression at this directory by executing the following command at a command prompt:

 

Enable Static Compression for a folder and run the following command:

Adsutil set w3svc/1/root/home/stylesheets/dostaticcompression false

 

 

 

All of the above are based on iis6. These operations provided by Microsoft are based on the command window. Of course, they can also be visualized. compression is enabled directly in IIS and in C: add the Server Extension gzip in the \ windows \ system32 \ inetsrv directory. DLL (IIS Server Extension), and then open the file c: \ windows \ system32 \ inetsrv \ metabase in this folder. XML. After opening the file, find filters/compression/gzip (this file is the IIS configuration file ).

Hcdodynamiccompression, hcdoondemandcompression, hcdostaticcompression. If you want to set dynamic File compression, enable the first one and set it to true. We recommend that you do not enable it. If you want to enable static File compression, set the last two to true and specify their respective compression levels: compressionlevel, which is 100, then, specify the type of the suffix of the compressed static file. I specify CSS, JS, and XML. after this parameter is specified, you need to stop the IIS service and stop it in the Windows service. Save after stopping. Then you can see in Fiddler that some of your files are compressed.
My compression application on our website compresses one of my kb JS files into 20 KB !!! Very efficient!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.