Enable gzip compression for IIS

Source: Internet
Author: User

The modern browsers IE6 and Firefox both support the client gzip. That is to say, before the webpage on the server is transmitted, Gzip compression is used before it is transmitted to the client. After receiving the webpage, the client is decompressed and displayed by the browser, in this way, although the CPU usage of some servers and clients is slightly occupied, the bandwidth utilization is higher. For plain text, the compression ratio is considerable. If each user saves 50% of the bandwidth, the bandwidth you lease will be able to serve customers more than doubled. 2. This function is integrated in iis6.0, but does not provide a good interface for operations.

 

L first, if you need to compress static files (HTML), you need to create a directory on the hard disk and give it the write permission of the user "IUSR _ machine name. It is not required to compress dynamic files (PHP, ASP, and aspx), because the pages are dynamically generated every time, so you can discard them after compression.

 

 

 

L add the gzip Web Service Extension and set it to valid

 

 

 

 

 

L set effective website Compression

 

 

 

Go to the "service" tab and choose to enable dynamic content compression and static content compression.

Restart IIS and the compression takes effect. However, the compressed file format is too small by default. You can set it further.

 

L modify metabase. xml. Backup is recommended first.

You can open it in notepad and find the iiscompressionscheme. There are three segments with the same name: deflate, Gzip, and parameters. The third segment does not need to be ignored. The first two segments have basically the same parameters.

Hcdynamiccompressionlevel: sets the compression rate. The value ranges from 0 ~ 10, 0 do not compress, 10 the highest compression rate, here set to 9, 9 is the most cost-effective.

Hcfileextensions: the extension of the static file to be compressed. By default, only htm, HTML, and TXT files are supported. You can add JS and CSS files. We recommend that you use line breaks as the separator based on the original format. Hcscriptfileextensions: the dynamic file extension to be compressed. Add aspx here.

Location = "/lm/w3svc/filters/compression/deflate" Settings

 

Location = "/lm/w3svc/filters/compression/gzip" Settings

 

 

L iisreset-Stop stop IIS and save metabase. xml

 

L iisreset-start IIS

 

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.