"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