Gzip compression configuration of Nginx in linux

Source: Internet
Author: User
Tags auth

Gzip configuration parameters of Nginx
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. To support earlier versions, this option is added. Currently, this option can be ignored.
Partam: 1.0 | 1.1
Example: gzip_http_version 1.0
Gzip_proxied
Enable Nginx 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;
Nginx gzip configuration parameters

Example:

The code is as follows: Copy code

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.