In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "methods of nginx current limit and configuration management". The editor shows you the operation process through actual cases, the operation method is simple, fast and practical. I hope this article "methods of nginx current limit and configuration management" can help you solve the problem.
Nginx current limit http {limit_conn_zone $binary_remote_addr zone=addr:10m; / / $binary_remote_addr means to restrict / / zone=addr:10m to generate a memory area with a size of 10m and the name addr. Server {location / download/ {limit_conn addr 1; # limit concurrency limit_rate 50k; # limit bandwidth}}
Limit the number of concurrent connections
$binary_remote_addr: indicates that the limit is made through the identity of remote_addr. The purpose of "binary_" is to abbreviate the memory usage and to limit the ip address of the same client.
Zone=addr:10m: generates a 10m memory area named addr, which is used to store access frequency information
Http status code
400-499 is used to indicate the client's error.
500-599 is used to support server errors.
Limit the access frequency of the same client
Rate=1r/s: indicates the access frequency of clients with the same identity. Here, the limit is once per second, that is, only one request per second can be processed. For example, 30r/m can limit access every 2 seconds, that is, only one request is processed every 2 seconds.
Burst
Burst=5:burst burst, this configuration means to set a buffer with a size of 5.
When there are a large number of requests (outbreaks), requests that exceed the access frequency limit can be placed in this buffer to wait, but there are only 5 locations in this waiting area, and requests exceeding 503 will directly report an error of 503 and then return.
Nodelay
If set, the ability to process (burst + rate) requests will be provided instantly, and will be returned directly when the request exceeds (burst + rate). There will never be a situation in which the request needs to wait. (the unit of rate here is: Ripple s.)
If not set, all requests will be queued in turn.
Limit_rate limits bandwidth
Nginx configuration management automatic indexing
Expire cache configuration
Location expression type
~ means to perform a regular match that is case sensitive
~ * means to perform a regular match, which is case-insensitive
^ ~ indicates a normal character match. Prefix matching is preferred. If the match succeeds, no other location is matched.
= exact matching of ordinary characters. That is, a perfect match.
@ "@" defines a named location that is used when directed internally, such as error_page, try_files
/: universal match. If there is no other match, any request will match to
Location expression priority
Location = > location full path > location ^ ~ path > location ~, ~ * regular order > location partial start path (prefix matching) > /
Log polling
For security, the log directory does not need to give you nginx user access, set # chmod-R 700 / usr/local/nginx/logs
Prohibit unnecessary directory logs
Restrictions on site directories and files
Chinese garbled code
Set up charset utf-8
This is the end of the introduction of "methods of nginx current restriction and configuration management". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.