IIS enable page gzip compression implementation Instructions _win server

Source: Internet
Author: User
Tags http request metabase
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. This article describes the HTTP compression method, using the Windows system settings, the advantage is high efficiency.

HTTP Compression Working principle
The Web server works with HTTP compression as follows:

After the Web server receives the HTTP request from the browser, check to see if the browser supports HTTP compression;
If the browser supports HTTP compression, the Web 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 see if the requested file has the latest compressed file;
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;
If the latest compressed file of the request file already exists, it returns the compressed file of the request file directly;
If the request file is a dynamic file such as ASPX, the Web server dynamically compresses the content and returns to the browser, and the compressed content is not stored in the compressed cache directory. Steps for configuring HTTP gzip compression in IIS 6.0:
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, and set the maximum limit for temporary directories and temporary directories as needed;
In Internet Information Services (IIS) Manager, right-click Web service extensions → add a new Web service extension ..., enter the extension "Httpcompression" in the new Web service Extension box, 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";
Using a text editor to open C:\Windows\System32\inetsrv\MetaBase.xml (recommended for backup), find location = "/lm/w3svc/filters/compression/gzip", If you need to compress a dynamic file, set HcDoDynamicCompression to TRUE, and in hcscriptfileextensions, add the dynamic file suffix name, such as ASPX, that you want to compress, and if you need to compress the static file, Set HcDoStaticCompression and HcDoOnDemandCompression to "TRUE" and add the static file suffix names you want to compress in hcfileextensions, such as XML, CSS, etc. HcDynamicCompressionLevel and HcOnDemandCompLevel indicate the required compression rate, the lower the compression rate;
Save the MetaBase.xml file when you are finished editing, or it may be in use by IIS if the file cannot be saved. Open "Start" → "Administrative Tools" → "service", Stop the "IIS Admin service", you can save;
Finally, restart IIS. You can verify the results on the HTTP compression test site.

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.