Module: Ngx_http_limit_conn_module
Function: Limit the number of concurrent connections according to the defined key
Example configuration:
HTTP { limit_conn_zone $binary _remote_addr zone=addr:10m; ... server { ... location/api/{ limit_conn addr; Limit_conn_status 503;}}}
Description: The example defines key (zone=addr) as addrand allocates a memory size of 10m ( zone=addr:10m (if the storage space for the restricted domain is exhausted, for all subsequent requests, the server will return 503), the same IP ( $binary _remote_addr ) and server connections more than 10 ( Limit_conn Addr ) will be intercepted and returned to 503 ( Limit_conn_status 503 ) error code
Related directives:
Limit_conn_zone
Limit_conn
Limit_conn_status
Limit_conn_log_level
Instruction Detailed:
Limit_conn_zone syntax: Limit_conn_zone key zone=name:size (set restriction rule, zone name, and allocated memory size) configurable area: Httpkey: required, set limit rule, value can be text, Nginx variable or combination of the two; the Nginx variable $binary_remote_addr used in the instance represents the Concurrency name: Required option based on each IP limit; a custom region name; arbitrary string size: allocates memory
Limit_conn Syntax: limit_conn zone number; (using an interception rule defined by Limit_conn_zone and setting a specific limit number of connections) configurable area: HTTP, server, Locationzone: required, name defined by Limit_conn_zone (zone=name); Indicates which restriction rule is used to define the number: Required option; positive integer; Indicates the specific limit of connections
Limit_conn_status syntax: limit_conn_status code; Default: 503 Configurable area: HTTP, server, location means exceeding Limit_ The error code returned to the client after the requested number of Req is configured to use the minimum version of the Directive 1.3.15
Limit_conn_log_level syntax: Limit_conn_log_level info | Notice | Warn | Error default: Limit_conn_log_level error; Configurable zone: HTTP, server, location set the required logging level when the server rejects processing requests because the rate exceeds or delays request processing. Minimum version: 0.8.18
Nginx Concurrent Connection Control module Ngx_http_limit_conn_module