Implement page compression using httpd in Apache

Source: Internet
Author: User

(1) The Web server processes HTTP compression as follows:

① After receiving the HTTP request from the browser, the Web server checks whether the browser supports HTTP compression.

(Accept-Encoding information );

② If the browser supports HTTP compression, the Web server checks the suffix of the request file;

③ If the requested file is a static file such as HTML and CSS, the Web server will check whether the latest compressed file of the requested file already exists in the compressed buffer directory;

④ If the compressed file of the request file does not exist, the Web server returns the uncompressed request file to the browser and stores the compressed file of the request file in the compressed buffer directory;

⑤ If the latest compressed file of the request file already exists, the compressed file of the request file is directly returned;

(2) Use of the Web server to process HTTP compression:

① Reduce I/O usage;

② Reduce bandwidth usage;

③ Optimized transmission speed;

(3) webpage setting rules

① Html, css, plain and other text files are compressed

② While mp3, jpg and other binary files do not need to be compressed, because the compression rate is low while wasting I/O

1. Page text compression module

LoadModule deflate_module modules/mod_deflate.soLoadModule mime_module modules/mod_mime.so

Deflate_module: Page compression module

Mime_module multimedia Module

MIME: multimedia type

HTTP: text/html

ASCII: text/plain

JPEG: image/jpeg

GIF: image/gif

QuickTime: video/quicktime

Check whether the dependency module is enabled

# Httpd-M | grep deflate

2. Edit the configuration file/etc/httpd24/httpd. conf.

3. Restart the httpd service.

# Service httpd24 restart

4. Test the webpage

This article from the "Wind thin pig" blog, please be sure to keep this source http://jungege.blog.51cto.com/4102814/1381357

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.