Nginx gzip configuration details

Source: Internet
Author: User

Gzip
Determine whether to enable the gzip Module
Param: on | off
Example: gzip on;

Gzip_buffers
Set the size of gzip applied memory. The function is to apply for memory space by a multiple of the block size.
Param1: int
Param2: the unit behind int (k) is k.
Example: gzip_buffers 4 8 k;

Gzip_comp_level
Set the gzip compression level. The lower the level, the faster the compression speed, the smaller the File compression ratio. The slower the speed, the larger the File compression ratio.
Param: 1-9
Example: gzip_com_level 1;

Gzip_min_length
When the returned content is greater than this value, gzip is used for compression. The unit is K. When the value is 0, all pages are compressed.
Param: int
Example: gzip_min_length 1000;

Gzip_http_version
Used to identify the http protocol version. Earlier Browsers Do not support gzip compression, and garbled characters are displayed. Therefore, this option is added to support earlier versions. Currently, this option can be ignored.
Partam: 1.0 | 1.1
Example: gzip_http_version 1.0

Gzip_proxied
Nginx is enabled as the reverse proxy,
Param: off | expired | no-cache | no-sotre | private | no_last_modified | no_etag | auth | any]
Expample: gzip_proxied no-cache;
Off-Disable Data Compression For All proxy results
Expired-enable compression. If the header contains "Expires" header information
No-cache-enable compression. If the header contains the "Cache-Control: no-cache" header
No-store-enable compression. If the header contains the "Cache-Control: no-store" header
Private-enable compression. If the header contains "Cache-Control: private" header information
No_last_modified-enable compression. If the header contains "Last_Modified" header information
No_etag-enable compression. If the header contains "ETag" header information
Auth-enable compression. If the header contains "Authorization" header information
Any-unconditionally compress all result data

Gzip_types
Sets the MIME type to be compressed. Non-set values are not compressed.
Param: text/html | application/x-javascript | text/css | application/xml
Example: gzip_types text/html;

Demo

Gzip on;
Gzip_min_length 1000;
Gzip_buffers 4 8 k;
Gzip_types text/html application/x-javascript text/css application/xml;

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.