IIS gzip compression)

Source: Internet
Author: User
Tags metabase
1. Http compression Overview

HTTP compression is used to transfer compressed text content between web servers and browsers. HTTP compression adopts common CompressionAlgorithmSuch as gzip to compress HTML, JavaScript, or CSS files. The biggest advantage of compression is that it reduces the amount of data transmitted over the network and increases the access speed of the client browser. Of course, it also adds a little load on the server. Gzip is a common HTTP compression algorithm.

This article introduces the HTTP compression method, which is set in windows, with the advantage of high efficiency.

Ii. How HTTP compression works

How the Web server processes 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 server checks the suffix of the request file;
If the requested file is a static file such as HTML and CSS, the web server will check whether the latest compressed file of the requested file already exists in the compressed buffer directory;
If the compressed file of the request file does not exist, the web server returns the uncompressed request file to the browser and stores the compressed file of the request file in the compressed buffer directory;
If the latest compressed file of the request file already exists, the compressed file of the request file is directly returned;
If the requested file is a dynamic file such as aspx, the web server dynamically compresses the content and returns it to the browser. The compressed content is not stored in the compressed cache directory.

3. to configure HTTP gzip compression in IIS 6.0:

1) Open the Internet Information Service (IIS) manager, right-click "website"-> "properties", and select "service ". Select "compression application" in the "HTTP compression" box.ProgramFiles "and" compressed static files ", set" temporary directory "and" maximum temporary directory limit "as needed ";

2) in the Internet Information Service (IIS) manager, right-click "Web Service extension"-> "and add a new Web Service extension... ", enter the extension" httpcompression "in the" New web service extension "box, and add the" required file "as C:" Windows "System32" inetsrv "gzip. DLL, the Windows System directory may vary depending on your installation, select "set extension status to allow ";

3) Use a text editor to open C: "Windows" System32 "inetsrv" metabase. in XML format (backup is recommended), locate location = "/lm/w3svc/filters/compression/gzip". To Compress dynamic files, set hcdodynamiccompression to "true ", add the suffix of the dynamic file you want to compress in hcscriptfileextensions, such as Aspx. If you want to compress static files, set hcdostaticcompression and hcdoondemancompression to "true ", in hcfileextensions, add the extension names of the static files to be compressed, such as XML and CSS. hcdynamiccompressionlevel and hcondemandcomplevel indicate the 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 the file. Open "start"-> "Administrative Tools"-> "service", stop "IIS Admin Service", and save the settings;

The actual compression effect is as follows. Simple settings have unexpected results.
Www.szzgc.com:
Compression or not Yes
Compression type Gzip
Original file size 279552 bytes
Compressed file size 39015 bytes
Compression Ratio (estimated) 86.04%

1. Http compression Overview

HTTP compression is used to transfer compressed text content between web servers and browsers. HTTP compression uses common compression algorithms such as gzip to compress HTML, JavaScript, or CSS files. The biggest advantage of compression is that it reduces the amount of data transmitted over the network and increases the access speed of the client browser. Of course, it also adds a little load on the server. Gzip is a common HTTP compression algorithm.

This article introduces the HTTP compression method, which is set in windows, with the advantage of high efficiency.

Ii. How HTTP compression works

How the Web server processes 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 server checks the suffix of the request file;
If the requested file is a static file such as HTML and CSS, the web server will check whether the latest compressed file of the requested file already exists in the compressed buffer directory;
If the compressed file of the request file does not exist, the web server returns the uncompressed request file to the browser and stores the compressed file of the request file in the compressed buffer directory;
If the latest compressed file of the request file already exists, the compressed file of the request file is directly returned;
If the requested file is a dynamic file such as aspx, the web server dynamically compresses the content and returns it to the browser. The compressed content is not stored in the compressed cache directory.

3. to configure HTTP gzip compression in IIS 6.0:

1) Open the Internet Information Service (IIS) manager, right-click "website"-> "properties", and select "service ". In the "HTTP compression" box, select "compressing Application Files" and "compressing static files", and set "temporary directory" and "maximum temporary directory limit" as needed ";

2) in the Internet Information Service (IIS) manager, right-click "Web Service extension"-> "and add a new Web Service extension... ", enter the extension" httpcompression "in the" New web service extension "box, and add the" required file "as C:" Windows "System32" inetsrv "gzip. DLL, the Windows System directory may vary depending on your installation, select "set extension status to allow ";

3) Use a text editor to open C: "Windows" System32 "inetsrv" metabase. in XML format (backup is recommended), locate location = "/lm/w3svc/filters/compression/gzip". To Compress dynamic files, set hcdodynamiccompression to "true ", add the suffix of the dynamic file you want to compress in hcscriptfileextensions, such as Aspx. If you want to compress static files, set hcdostaticcompression and hcdoondemancompression to "true ", in hcfileextensions, add the extension names of the static files to be compressed, such as XML and CSS. hcdynamiccompressionlevel and hcondemandcomplevel indicate the 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 the file. Open "start"-> "Administrative Tools"-> "service", stop "IIS Admin Service", and save the settings;

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.