Set gzip page compression in iis

  
        

A. HTTP compression overview: HTTP compression is a method of transferring compressed text content between a web server and a browser. HTTP compression compresses HTML, JavaScript, or CSS files using common compression algorithms such as gzip. The biggest benefit of compression is to reduce the amount of data transmitted by the network, thereby increasing the access speed of the client browser. Of course, it will also increase the burden on the server. Gzip is a relatively common HTTP compression algorithm.

The HTTP compression method introduced in this article uses the Windows system setting method, which has the advantage of high efficiency.

II. How HTTP compression works: The working principle of HTTP server processing HTTP compression is as follows: After receiving the HTTP request from the browser, the web server checks whether the browser supports HTTP compression. If the browser supports HTTP compression, the Web The server checks the suffix name of the request file; if the request file is a static file such as HTML or CSS, the web server checks the compressed buffer directory to check whether the latest compressed file of the requested file already exists; if the compressed file of the requested file does not exist, the web server browses Returns the uncompressed request file and stores the compressed file of the requested file in the compressed buffer directory; if the latest compressed file of the requested file already exists, directly returns the compressed file of the requested file; if the requested file is a dynamic file such as ASPX, Web The server dynamically compresses the content and returns it to the browser. The compressed content is not stored in the compressed cache directory.

III. Steps for configuring HTTP Gzip compression in IIS 6.0:

1) Open Internet Information Services (IIS) Manager and right click on "Website"->"Properties" ;, select "Services". In the "HTTP Compression" box, select "compress application files" and "compress static files", and set "temporary directories" and "maximum restrictions for temporary directories" as needed;

2) In the Internet Information Services (IIS) Manager, right-click "Web Service Extensions"->"Add a new Web Service Extension...", in "New Web Service Extension" In the box, enter the extension "HTTP Compression", add "required file" to C:\\WINDOWS\\system32\\inetsrv\\gzip.dll, where the Windows system directory may vary depending on your installation, check " Set the extension status to Allow ";

3) Open C:\\Windows\\System32\\inetsrv\\MetaBase.xml with a text editor (recommended first) and find Location ="/LM/W3SVC/Filters /Compression/gzip", if you need to compress dynamic files, set HcDoDynamicCompression to "TRUE", and add the dynamic file suffix name you want to compress in HcScriptFileExtensions, such as ASPx; if you need to compress static files, HcDoStaticCompression and HcDoOnDemandCompression are set to "TRUE", and add the static file suffix name you need to compress in HcFileExtensions, such as xml, css, etc.; HcDynamicCompressionLevel and HcOnDemandCompLevel indicate the required compression ratio, the smaller the number, the lower the compression ratio;

4) Save the MetaBase.xml file after editing; if the file cannot be saved, IIS may be using it. Open "Start"->"Administrative Tools"->"Services", Stop "IIS Admin Service", you can save;

5) Finally, restart IIS . You can verify the results by going to the HTTP compression test site.

Copyright © Windows knowledge All Rights Reserved