Standalone host/vps One-click to open IIS's Gzip method _win server

Source: Internet
Author: User
Tags php and vps
Windows Server Setup Method:
Download Address: Iis6-set-gzip.rar
Download gzip batch files, extract to any location, double-click Run Iis6-set-gzip.cmd can quickly set gzip.
Special Tips If your site has CDN technology enabled, do not turn on the gzip feature, otherwise it will result in the client access to a blank situation, set up, you can pass the http://tool.chinaz.com/Gzips/to test the results of compression, as shown:

Gzip can compress static htm\html\css\js\asp\aspx\php and other format files, depending on the format of different files contain different content, compression rate is not the same.

Advantages: Can speed up Web site access, reduce the occupancy rate of bandwidth.

Disadvantage: Will consume more CPU resources to compress the page.

So if your CPU is high after you set it up, please cancel the check of HTTP compression and restart IIS on the iis--Web site-Properties-service. (Recommended: More than 10 VPS stations do not turn on the compression function)

The compressed cache file is stored in C:\WINDOWS\IIS temporary compressed files so it is recommended that the iis--site--attributes--service, set a size, to avoid the C disk is occupied. As shown in figure:

Linux Server Setup methods:

There are two types of modules that are compressed using the GZIP compression algorithm on Apache: Mod_gzip and Mod_deflate. To use gzip Web compression, first make sure that your server has enabled support for one of these two components. Although the use of Gzip also requires the support of the client browser, but do not worry, most browsers have already supported gzip, such as IE, Mozilla Firefox, Opera, Chrome and so on.

By looking at the HTTP headers, we can quickly determine whether the client browser that is being used supports gzip compression.

If the following message appears in the HTTP header that is sent, your browser supports the appropriate gzip compression:

Accept-encoding:gzip Support Mod_gzip
accept-encoding:deflate Support Mod_deflate
accept-encoding:gzip,deflate while supporting Mod_gzip and Mod_deflate

If the server has enabled the Gzip component, then we can customize it in http.conf or. htaccess, and here is a simple example of a. htaccess configuration:

# Mod_gzip:
<ifmodule mod_gzip.c>
mod_gzip_on Yes
Mod_gzip_dechunk Yes
Mod_gzip_item_include file \. (html?| TXT|CSS|JS|PHP|PL) $
Mod_gzip_item_include Handler ^cgi-script$
Mod_gzip_item_include MIME ^text/.*
Mod_gzip_item_include MIME ^application/x-javascript.*
Mod_gzip_item_exclude Rspheader ^content-encoding:.*gzip.*
</ifModule>

# Mod_deflate:
<ifmodule mod_deflate.c>
Deflatecompressionlevel 6 #压缩率, 6 is the recommended value.
Addoutputfilterbytype DEFLATE Text/plain
Addoutputfilterbytype DEFLATE text/html
Addoutputfilterbytype DEFLATE Text/xml
Addoutputfilterbytype DEFLATE Text/css
Addoutputfilterbytype DEFLATE Text/javascript
Addoutputfilterbytype DEFLATE Application/xhtml+xml
Addoutputfilterbytype DEFLATE Application/xml
Addoutputfilterbytype DEFLATE Application/rss+xml
Addoutputfilterbytype DEFLATE Application/atom_xml
Addoutputfilterbytype DEFLATE Application/x-javascript
Addoutputfilterbytype DEFLATE application/x-httpd-php
Addoutputfilterbytype DEFLATE Image/svg+xml
</ifmodule>

Inside the file MIME type can be added according to their own situation, as for PDFs, pictures, music documents, such as these are already highly compressed format, the role of repetitive compression is not large, but may be due to increase CPU processing time and browser rendering problems and reduce performance. So there's no need to compress it again through gzip.

After you view the HTTP headers that are returned by using the above settings, the following information indicates that the returned data has been compressed. The gzip compression configured by the Web site program is in effect. You can also query for gzip compression by http://tool.chinaz.com/gzips/  here.

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.