Apache HTTP protocol content compression reduces access traffic elevation

Source: Internet
Author: User
"HTTP protocol content compression"


Content-ecoding:gzip
Principle: In order to speed up the transmission speed of the Web page, the server compresses the main information
such as the common gzip compression compress compression, and the google-chrome is being implemented
The SDCH compression


The compression process is as follows


Client receives compressed file server
Compression <-----------response
Decompression and rendering
Page


So content-length is the length of the compression.


"How to turn on the compression on Apache"

1, open the Deflate module or gzip module

LoadModule Deflate_module modules/mod_deflate.so


2, in the Conf ask the part to join
<ifmodule mod_deflate.c>
deflatecompressionlevel 6 
addoutputfilterbytype deflate Text/plain 
Addoutputfilterbytype DEFLATE text/html
addoutputfilterbytype DEFLATE text/xml
DEFLATE text/css
addoutputfilterbytype DEFLATE text/javascript addoutputfilterbytype DEFLATE application/
Xhtml+xml
addoutputfilterbytype DEFLATE application/xml
addoutputfilterbytype DEFLATE
addoutputfilterbytype DEFLATE application/atom_xml
Addoutputfilterbytype DEFLATE application/x-javascript
addoutputfilterbytype DEFLATE application/x-httpd-php
addoutputfilterbytype DEFLATE application/svg+xml
</IfModule>




Why do I specify a compression type
Compression to consume CPU resources, image video compression effect is not significant
Files in general compressed text format


3, restart Apache
Running the page will save 30%-40% of the traffic


How the server knows that browsers support gzip.
A: Browsers can allow you to send a
Accept-ecoding header information and server negotiation compression format
Chrome supports gzip deflate SDCH
Firefox support gzip deflate


Small tips:
Collect without sending accept-ecoding direct collection source
can also send, but need to use PHP to decompress



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.