Module ngx_http_limit_req_module | ![]() english עברית 日本語 русский türkçe news about download security advisories documentation introduction pgp keys howto faq trac wiki links books support donation nginx.com @nginxorg | ||||||||||||||||||
The Example Configuration
Directives
Sets a zone and the maximum allowed burst of requests. If the rate of requests exceeds the rate configured for a zone, request processing is delayed such as that they are processed at a defined rate. Excessive requests are delayed until their number exceeds the defined number of bursts. In this case, the request is terminated with an error 503 (Service Temporarily Unavailable). By default, the number of bursts is equal to zero. For example, the directives allow not more than 1 request per second at an average, with bursts not exceeding 5 requests.
If delaying of excessive requests while requests are being limited is not
desired, the parameter limit_req zone=one burst=5 nodelay;
This directive appeared in version 0.8.18.
Sets the desired logging level for cases when the server limits
the number of requests, or delays request processing.
Delays are logged with the level one less than limits; for example,
if “
Sets the parameters for a zone that keeps states for various keys. This state stores the current number of requests in particular. The key is any non-empty value of the specified variable (empty values are not accounted). Example usage: limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
Here, the states are kept in a 10 megabyte zone “one”, and an average rate of requests for this zone cannot exceed 1 request per second.
An IP address of the client serves as a key.
Note that instead of The rate is specified in requests per second (r/s). If a rate of less than one request per second is desired, it is specified in request per minute (r/m). For example, half-request per second is 30r/m. |