In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "the configuration of Nginx data compression". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Nginx data compression configuration:
Add the following configuration items to the http module of Nginx's nginx.conf file
# gzip Compression feature configuration
Gzipon
Gzip_min_length2k
Gzip_buffers4 16k
Gzip_http_version1.0
Gzip_comp_level6
Gzip_proxiedany
Gzip_typestext/css text/xml image/gif image/jpeg image/png application/javascriptimage/x-ms-bmp application/pdf text/plain application/jsonapplication/xhtml+xml
Gzip_vary on
Gzip_disable "MSIE [1-6]."
Configuration item description:
Gzip: decide whether to turn on the gzip module
Param:on | off
Example:gzipon
Gzip_buffers: sets the gzip request memory size, which is used to apply for memory space in multiples of the block size.
Param1:int
The unit after param2:int (k) is k.
Example: gzip_buffers 4 8k
Gzip_comp_level: set the gzip compression level. The lower the compression level, the faster the compression speed, the smaller the file compression ratio, and vice versa, the slower the speed, the greater the file compression ratio.
Param:1-9
Example:gzip_com_level 6
Gzip_min_length: when the returned content is greater than this value, gzip is used to compress. When the value is 0, all pages are compressed.
Param:int
Example:gzip_min_length 1000
Gzip_http_version: used to identify the version of the http protocol. Early browsers do not support gzip compression, and users will see garbled code, so this option is added to support the previous version, and this item can be ignored at present.
Param: 1.0 | 1.1
Example:gzip_http_version 1.0
Gzip_types: sets the MIME type to be compressed. Non-set values do not compress.
Param:text/html | application/x-javascript | text/css | application/xml
Example:gzip_types text/html
Gzip_proxied: enabled when Nginx is used as a reverse proxy
Param:off | expired | no-cache | no-sotre | private | no_last_modified | no_etag | auth | any
Expample:gzip_proxiedno-cache
Off-turn off all agent result data compression
Expired-enables compression if the header contains "Expires" header information
No-cache-enables compression if the header contains "Cache-Control:no-cache" header information
No-store-enables compression if the header contains "Cache-Control:no-store" header information
Private-enables compression if the header contains "Cache-Control:private" header information
No_last_modified-enables compression if the header contains "Last_Modified" header information
No_etag-enables compression if the header contains "ETag" header information
Auth-enables compression if the header contains "Authorization" header information
Any-unconditionally compress all result data
Gzip_vary: add the http header information Vary: Accept-Encoding to the back-end proxy server to identify whether gzip compression is enabled.
Param:on | off
Expample:gzip_varyon
Gzip_disable: close Gzip according to the "User-Agent" header, using regular expressions.
Param:regex (regular expression)
Example:gzip_disable "MSIE [1-6]."
This is the end of the content of "configuration of Nginx data compression". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.