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 points of this paper are collected from the Internet, mainly from Chinese wiki. Gzip is critical when using YSlow to detect which optimizations are enabled on the Web site. Starting GIP compression will instantly reduce the network transmission size of the page.
three. HTTP Compression overview
HTTP compression is a way to transfer compressed text content between a Web server and a browser. 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
web server processing HTTP compression works as follows:
1.Web the server receives the browser's HTTP request, checks whether the browser supports HTTP compression, &NBSP
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 Click Jump to MSDN Note
3. If the request file is a static file such as HTML, CSS, and the file suffix is compressed, the Web server checks to the compressed buffer directory for the most recent compressed file of the request file;
4. If the requested file's compressed 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 most recent compressed file of the request file already exists, it directly returns the compressed file of the request file;
6. If the request file is a dynamic file such as aspx 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 a simple configuration
1. Open Internet Information Services (IIS) Manager, right-click the 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;
current 1/3 page
123 the next page to read the full text