How to enable Gzip

Source: Internet
Author: User

How can I enable the Gzip function and compress webpages to speed up the website!

EnabledGzip compression.

Unknown truth? Look down:

What is Gzip? (Skip this step if you already know it)

Gzip is short for GNU zip. It is a File compression program of GNU free software. It was first created by Jean-loup Gailly and Mark Adler for File compression on UNIX systems. We often use files suffixed with .gz in linux, which are in Gzip format. Nowadays, it has become a widely used data compression format on the Internet, or a file format. GZIP encoding on HTTP is a technology used to improve the performance of WEB applications. Large-Traffic WEB sites often use Gzip compression technology to make users feel faster. This generally refers to a function installed on the WWW server. When someone visits the website on this server, this function in the server compresses the webpage content and then transmits it to the visiting Computer Browser for display. Generally, the plain text content can be compressed to 40% of the original size.

What are the advantages of Gzip? (Skip this step if you already know it)

After Gzip is enabled, Gzip is compressed before being transmitted to the client. After receiving the data, the client is decompressed and displayed by the browser. This will reduce the amount of data transmitted over the network and increase the browsing speed.

I have never turned on such a good thing. I despise myself first. Well, the following describes how to enable this function.

IIS6.0 how to enable Gzip compression:

1. Create a Web service extension (for example)

Dll path: "c: \ windows \ system32 \ inetsrv \ gzip. dll", and then enable it.

2. enable HTTP compression in WebSite Services (for example)

The read and write permissions for the temporary directory must be granted to IIS users.

3. Modify the IIS configuration file MetaBase. xml

File Path: "c: \ windows \ system32 \ inetsrv \" (please firstBackupTo another location), open it, search for "HcDynamicCompressionLevel", and modify it (confirmBackup) "Compression/deflate" and "Compression/gzip. The content modified in Figure n and Figure B below is intended to add js, css, and php to the compression scope. Number 9 indicates the compression level.


(Figure n)


(Figure B)

4. Restart the IIS service to make it take effect.

------------------ Split and cut -----------------

How to enable Gzip compression in Apache:

1. Enable the module and add a configuration item

A, vi/etc/httpd/conf/httpd. conf

B. Find LoadModule (/LoadModule) and add "LoadModule deflate_module modules/mod_deflate.so ".

C. Add a configuration item (the following content)

<IfModule mod_deflate.c>
# Compression grade 9
DeflateCompressionLevel 9
# Compression types: html, xml, php, css, and js
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/x-httpd-php
AddOutputFilter DEFLATE js css
</IfModule>

2. Restart apache to make it take effect.

Service httpd start

------------------ Split and cut -----------------

Check whether Gzip is supported, here: http://tool.chinaz.com/Gzips/

To modify metabase. xml, after I open the file, the modification is complete. However, when I click Save, the system always prompts "the file is in use and cannot be saved ". Later, I searched Baidu and found a solution. The following two solutions are available. We recommend that you use the first one.

First, modify the properties of the local computer.

1. Open iis manager, right-click the local computer, and select Properties, as shown in figure



2. Select "allow directly edit configuration database" to edit the metabase. xml file without stopping IIS.


3. Now, try editing the metabase. xml file and save the file.

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.