Optimizing the Apache Web compression

Optimizing the Apache Web compression

Article Directory

A, gzip Introduction

Two, Apache compression module

Third, the comparison module mod_deflate module mod_gzip

Four, page compression

V. Summary

A, gzip Introduction

Configuring Apache Web compression, after using gzip compression algorithm to compress web content, and then transferred to the client browser

effect:

Reduce the number of bytes transmitted over the network, speed up page load

Save traffic, improve the user's browsing experience

gzip and search engine crawlers have a better relationship

Two, Apache compression module

Apache web page compression to achieve functional modules include

mod_gzip module

mod_deflate module

Apache 1.x

No built-in web compression technology, but may use a third party to perform compression module mod_gzip

Apache 2.x

During development, built mod_deflate this module, replace mod_gzip

Third, the comparison module mod_deflate module mod_gzip

Both use gzip compression algorithm, similar to how it works

mod_deflate compression speed road fast, and slightly higher compression ratio mod_gzip

mod_gzip occupation of the server CPU to be higher

High-traffic server, using the mod the deflate may be higher than mod faster loading speed gzip

Four, page compression

1, mount the shared file and extract to / opt / directory.

Optimizing the Apache Web compression

Installation package optimization

Optimizing the Apache Web compression

2, install compilation tools

Optimizing the Apache Web compression

3, the configuration /opt/httpd-2.4.2

Optimizing the Apache Web compression

4、执行 make && make install

5, open the main Apache configuration file, see the module

Optimizing the Apache Web compression

Modify the port and domain name

Optimizing the Apache Web compression

Optimizing the Apache Web compression

Headers LoadModule Module modules / MOD headers. // SO enabled by default

Deflate the LoadModule Module1 modules / MOD deflate. // SO deflate module removed from the front opening #

Filter LoadModule Module modules / MOD filter. SO // enabled by default

Optimizing the Apache Web compression

Add at the end of file

Optimizing the Apache Web compression

Verify apache is set success

Optimizing the Apache Web compression

6, open the apache service, turn off the firewall, and open verification module

Optimizing the Apache Web compression

7, in the win10 system installation capture tool Fiddler, find the installation package directly online.

Optimizing the Apache Web compression

Optimizing the Apache Web compression

8, the packet capture tool Fiddler4, you can see allow gzip, but does not display the specified compressed content.

Optimizing the Apache Web compression

Optimizing the Apache Web compression

Optimizing the Apache Web compression

Refresh the page, insert the picture appears

Displayed in the capture tool transmission process gzip compression.

Optimizing the Apache Web compression1576936360070

V. Summary

Configuring Apache Web compression, transmission to the client browser, reducing the number of bytes transmitted over the network, speed up page load.

Note: apache service turned remember: in / usr / local / httpd / bin / below ./apachectl strat

Guess you like

Origin blog.51cto.com/14557584/2460670