In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Nginx Gzip module enable and configuration instructions what, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can harvest.
This article mainly introduces the Nginx Gzip module enabling and configuration instructions in detail, friends who need it can refer to the following
Nginx's gzip module is built-in. Add the following configuration to http:
The code is:gzip on;
gzip_min_length 5k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 3;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
Configuration Instruction Detailed Notes:
gzip on|off
Default: gzip off Turn on or off the gzip module
gzip_static on|off
nginx module for static file processing This module can read pre-compressed gz files, which can reduce CPU resource consumption per request for gzip compression. After the module is enabled, nginx first checks whether there is a file at the end of gz requesting a static file, and if there is, returns the content of the gz file directly. To be compatible with browsers that do not support gzip, enabling the gzip_static module requires that both the original static file and the gz file be preserved. This will greatly increase disk space when there are a large number of static files. We can use nginx's reverse proxy feature to keep only gz files. Google"nginx gzip_static" to learn more
gzip_comp_level 4
Default value: 1(recommended to choose 4)gzip compression ratio/compression level, compression level 1-9, the higher the level, the greater the compression ratio, of course, the longer the compression time (faster transmission but more CPU consumption).
gzip_buffers 4 16k
Default: gzip_buffers 4 4k/8k Settings The system takes several units of cache for storing gzip compressed result streams. For example, 4 4k means that the memory is applied in units of 4k according to 4 times the original data size in units of 4k. 4 8k means to request memory in units of 8k, 4 times the original data size in units of 8k. If not set, the default is to request the same amount of memory as the original data to store the gzip results.
gzip_types mime-type [mime-type …]
Default value: gzip_types text/html (default does not compress js/css files) Compression type, matching MIME type for compression Cannot use wildcard text/*(whether specified or not)text/html Default has been compressed Set what kind of compressed text file can refer to conf/mime.types
gzip_min_length 1k
Default value: 0, regardless of page size compression settings allow the minimum number of bytes compressed page, page bytes from the header header in the Content-Length obtained. It is recommended to set the number of bytes to greater than 1k, and less than 1k may increase the pressure. i.e.: gzip_min_length 1024
gzip_http_version 1.0|1.1
Default: gzip_http_version 1.1(i.e. gzip only for HTTP/1.1 requests) Identify the http protocol version. Since some early browsers or http clients may not support gzip self-decompression, users will see garbled code, so it is necessary to make some judgments. Note: 99.99% of browsers basically support gzip decompression, so you can not set this value, keep the system default. Suppose we use the default value of 1.1. If we use proxy_pass for reverse proxy, then nginx communicates with upstream server on the backend using HTTP/1.0 protocol. If we use nginx as Cache Server through reverse proxy, and nginx on the frontend does not have gzip enabled, and gzip_http_version is not set to 1.0 on nginx on the backend, then the url of Cache will not be gzip compressed.
gzip_proxied [off|expired|no-cache|no-store|private|no_last_modified|no_etag|auth|any] …
Default value: When Nginx is enabled as a reverse proxy, the results returned by turning on or off the backend server match the premise that the backend server must return a header containing "Via". Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.
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.