Nginx series (17) nginx compressed output configuration

Source: Internet
Author: User
: This article mainly introduces the Nginx series (17th) nginx compression output configuration. if you are interested in the PHP Tutorial, please refer to it. 1. configuration file

Gzip on; gzip_min_length 1 k; gzip_buffers 1664 k; gzip_http_version 1.1; gzip_comp_level 6; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on;

II. related parameters

Gzip on;
// This command is used to enable or disable the gzip module (on/off)

Gzip_min_length 1 k;
// Sets the minimum number of page bytes that can be compressed. the number of page bytes is obtained from the content-length header of the header. The default value is 0, and most pages are compressed. We recommend that you set the size to 1 kb. smaller than 1 KB may increase the pressure.

Gzip_buffers 4 16 k;
// Set the system to obtain several units of cache for storing gzip compressed result data streams. 4 16 K indicates that the size of the original data is 4 times the size of the requested memory in 16 K.

Gzip_http_version 1.1;
// Identify the http protocol version (1.0/1.1)

Gzip_comp_level 2;
// Gzip compression ratio. the minimum compression ratio is the fastest, and the maximum compression ratio is 9, but the processing speed is the slowest (fast transmission but cpu consumption)

Gzip_types text/plain application/x-javascript text/css application/xml
// Match the mime type for compression. whether specified or not, the "text/html" type is always compressed.

Gzip_vary on;
// It is related to the http header and adds a vary header for the proxy server. some browsers support compression and some do not support compression, so avoid wasting and compressing unsupported ones, therefore, we can determine whether compression is required based on the HTTP header of the client.

The above introduces the Nginx series (17th) nginx compression output configuration, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.

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.