Has your website opened gzip?

Source: Internet
Author: User

Intermediary transaction SEO diagnosis Taobao guest Cloud host technology Hall

Written in front of the article, a lot of new webmaster, to speed up the speed of Web site access only exist in the server and template selection above, in fact, gzip page compression can greatly enhance the speed of Web site access, for the site in foreign stations, this is an essential step to improve the speed of the Web page open very Now we have a systematic understanding of this gzip.

First, what is gzip

Gzip Concept

Gzip was first created by Jean-loup Gailly and Mark Adler to Unⅸ file compression for the system. We often use the file suffix. gz in Linux, which is in gzip format. Today has become a very popular data compression format, or a file format, used on the Internet.

The gzip encoding on the HTTP protocol is a technique used to improve the performance of Web applications. Large-volume Web sites often use gzip compression technology to allow users to experience faster speeds. This is generally referred to as a feature installed in the WWW server, when someone comes to the Web site in this server, this function in the server will compress the content of the Web page and transmit it to the visiting Computer browser. Generally, plain text content can be compressed to 40% of the original size. So the transmission is fast, The effect is that you click on the URL will be quickly displayed. Of course, this also increases the load on the server. The function module is installed in the general server.

Second, open gzip what is the benefit?

Gzip opened will be output to the user's browser data compression processing, which will reduce the amount of data transmitted over the network, improve the speed of browsing. Gzip can greatly accelerate the site. Sometimes the compression ratio is high to 80%, at least 40% or more.

Third, how to turn on gzip compression.

1. IIS article:

First open IIS, right click on the site to select the service, as shown

  

Check the HTTP compression of the 2 options, temporary directory can use the default C disk directory, if C disk space is tight, you can create your own. Note here that the directory needs to give the user "IUSR_ machine name" Write permission, otherwise it will not open gzip. At the same time, if your space is not very abundant, then you can limit the size of the directory capacity. Otherwise the traffic is big station, the temporary file here will be big scary.

Step two, right click on the IIS Web service extension

  

As shown in the picture, the extension is arbitrary, the file location is selected C:\windows\system32\inetsrv\gzip.dll, and the setting extension status is determined and checked to allow

Here, some webmaster's website also opened Gzip, but some of the still need to manually modify the configuration, then continue to look down

Step three, open the C:\windows\system32\inetsrv\ folder, look for MetaBase.xml, copy backup first, open the file in Notepad

Search location = "/lm/w3svc/filters/compression/gzip"

There will be three paragraphs with the same name, namely Deflate,gzip,parameters

..

..

..

Here we only need to modify the first 2 parts, here to note whether MetaBase.xml have write permission, otherwise can not save:

Hccompressiondll= "%windir%\system32\inetsrv\gzip.dll"

hccreateflags= "0"

hcdodynamiccompression= "TRUE"

hcdoondemandcompression= "TRUE"

hcdostaticcompression= "FALSE"

Hcdynamiccompressionlevel= "0"

hcfileextensions= "htm

html

txt"

Hcondemandcomplevel= "10"

hcpriority= "1"

hcscriptfileextensions= ASP

Dll

Exe"

>

Hccompressiondll= "%windir%\system32\inetsrv\gzip.dll"

hccreateflags= "1"

hcdodynamiccompression= "TRUE"

hcdoondemandcompression= "TRUE"

hcdostaticcompression= "TRUE"

Hcdynamiccompressionlevel= "0"

hcfileextensions= "htm

html

txt"

Hcondemandcomplevel= "10"

hcpriority= "1"

hcscriptfileextensions= ASP

Dll

Exe"

>

Replace

Hccompressiondll= "%windir%\system32\inetsrv\gzip.dll"

hccreateflags= "1"

hcdodynamiccompression= "TRUE"

hcdoondemandcompression= "TRUE"

hcdostaticcompression= "TRUE"

Hcdynamiccompressionlevel= "10"

hcfileextensions= html

css

js

htm

xml

txt"

Hcondemandcomplevel= "10"

hcpriority= "1"

hcscriptfileextensions= "PHP

Dll"

>

Hccompressiondll= "%windir%\system32\inetsrv\gzip.dll"

Hccreateflags= "2"

hcdodynamiccompression= "TRUE"

hcdoondemandcompression= "TRUE"

hcdostaticcompression= "TRUE"

Hcdynamiccompressionlevel= "10"

hcfileextensions= html

css

js

htm

xml

txt"

Hcondemandcomplevel= "10"

hcpriority= "1"

hcscriptfileextensions= "PHP

Dll"

>

Do not save immediately after the replacement, open the service, stop IIS, point to save, and then start the IIS, Httl and WWW services, you can

VPS and servers can be opened by the above steps gzip, virtual host needs to ask service providers.

2. Apache Enabling Chapter

First check to see if Apache has loaded the mod_deflate.so module, if there is no need to install the load. Locate and download the same source file as the current Apache version, extract it into the filesystem directory and execute it under the Apache installation directory:

/usr/local/apache2/bin/apxs-i-c/home/httpd-2.0.63/modules/filters/mod_deflate.

is automatically added to the httpd.conf

LoadModule Deflate_module modules/mod_deflate.so

Add the following settings:

#Insert Filter

Setoutputfilter DEFLATE

# Netscape 4.x super-delegates some problems ...

Browsermatch ^MOZILLA/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems

Browsermatch ^mozilla/4\.0[678] No-gzip

# MSIE masquerades as Netscape, but it is fine

# Browsermatch \bmsie!no-gzip!gzip-only-text/html

# Note:due to a bugs in mod_setenvif up to Apache 2.0.59

# The adjective regex won ' t work. can use the following

# Workaround to get the desired multiplying:

# browsermatch \bmsie!no-gzip!gzip-only-text/html force-gzip

Browsermatch \bmsie!no-gzip!gzip-only-text/html

# Don ' t compress images and other

Setenvifnocase Request_uri. (?: gif|jpe?g|png) $ no-gzip dont-vary

Setenvifnocase Request_uri. (?: Exe|t?gz|zip|bz2|sit|rar) $ no-gzip dont-vary

Setenvifnocase Request_uri. (?:p df|doc) $ no-gzip dont-vary

Addoutputfilterbytype DEFLATE html filetype by text/css

Addoutputfilterbytype DEFLATE Application/x-javascript

# make throaty proxies don t deliver the wrong content

Header Append Vary User env=!dont-vary

#DeflateFilterNote ratio Ratio_info

#LogFormat ' "%v%h%l%u%t"%r "%>s%b"%{referer}i ""%{user-agent}i "(%{ratio}n) ' deflate

#CustomLog Logs/deflate_log Deflate

Stop the Apache service./apachectl stop, the error is as follows:

cant load/usr/local/apache2/modules/mod_deflate.so into server:/usr/local/apache2/modules/mod_deflate.so: Undefined symbol:deflate

Resolved as follows:

Vi/usr/local/apache2/bin/apr-config

Modify Ldflags= "" for ldflags= "-lz"

Stop start service: still prompt:

Deflatefilternote not even

Customlog not even

Comment out, normal.

The above is gzip open the general steps, test can go to Webmaster Tool Station test can, love station and stationmaster have. Gzip really must have.

Four, on the network on some of the open gzip after the spider crawling problems, basically for dynamic sites, static site gzip is absolutely safe. Hope that the dynamic site does not open easily, well, start your gzip road

Yao Yang Network www.c9dy.com

Related Article

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.