Enable gzip compression on IIS (HTTP compression)

Source: Internet
Author: User
Keywords Nbsp; http Enabled IIS
Tags browser browsers click content directory display file files
I. Summary

This article summarizes how to enable gzip compression for Web sites that are hosted by IIS, thereby reducing the network transmission size of your Web page and increasing the speed at which users can display pages.

Two. Preface.

The knowledge of this article is from the Internet collection and collation, mainly from the Chinese wiki. When you use YSlow to detect which optimizations are enabled on your Web site, gzip is a critical item, and starting GIP compression will immediately reduce the network transmission size of the page.

Three. HTTP Compression overview

HTTP compression is a way to transfer compressed text content between Web servers and browsers. HTTP compression uses a common compression algorithm such as gzip compression HTML, JavaScript, or CSS files. The biggest benefit of compression is that it reduces the amount of data transferred by the network, thereby increasing the access speed of the client browser. Of course, it will also add a little bit of server burden. Gzip is a more common kind of HTTP compression algorithm.

Four. HTTP Compression working principle

The Web server works with HTTP compression as follows:

After the 1.WEB server receives the HTTP request from the browser, check to see if the browser supports HTTP compression;
In the HTTP header where the user's browser sends the request, the "accept-encoding:gzip, deflate" parameter indicates that the gzip and deflate two compression algorithms are supported.

2. If the browser supports HTTP compression, the Web server checks the suffix name of the request file; both the static file and the dynamic file suffix startup need to be set in MetaBase.xml.
Static files need to be set: HcFileExtensions Metabase Property (click Jump to MSDN Description)
Dynamic files need to be set: HcScriptFileExtensions Metabase Property (click Jump to MSDN Description)

3. If the request file is a static file such as HTML, CSS, and the file suffix is compressed, the Web server checks the compressed buffer directory to see if the requested file has the latest compressed file;

4. If the compressed file of the request file does not exist, the Web server returns the uncompressed request file to the browser and holds the compressed file of the request file in the compressed buffer directory;

5. If the latest compressed file of the request file already exists, then directly returns the compressed file of the request file;

6. If the request file is an ASPX dynamic file and the file suffix has compression enabled, the Web server dynamically compresses the content and returns to the browser, and the compressed content is not stored in the compressed cache directory.

Five. Enable HTTP compression in IIS

IIS does not support HTTP compression by default, and requires simple configuration

1. Open Internet Information Services (IIS) Manager, right-click Web site-> properties, and select Services. In the HTTP Compression box, select Compress application files and compress static files, setting the maximum limit for temporary directories and temporary directories as needed;

2. Reminder: After testing this step on my machine has no effect, you can ignore.
In Internet Information Services (IIS) Manager, right-click "Web Service Extensions"-> "Add a new Web service extension ...", in the new Web service Extension box, enter the extension "HTTP Compression" and add "required files" as C:\ Windows\system32\inetsrv\gzip.dll, where the Windows system directory may vary depending on your installation, select "Set extension status to allow";

Continue >> Next [1th] [page 2nd] [3rd]

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.