Syntax: | limit_conn_zone
|
---|---|
Default: | — |
Context: | http |
Sets parameters for a shared memory zone that will keep states for various keys. In particular, the state includes the current number of connections. The key
can contain text, variables, and their combination. Requests with an empty key value are not accounted.
Prior to version 1.7.6, a key
could contain exactly one variable.
Usage example:
limit_conn_zone $binary_remote_addr zone=addr:10m;
Here, a client IP address serves as a key. Note that instead of $remote_addr
, the $binary_remote_addr
variable is used here. The $remote_addr
variable’s size can vary from 7 to 15 bytes. The stored state occupies either 32 or 64 bytes of memory on 32-bit platforms and always 64 bytes on 64-bit platforms. The $binary_remote_addr
variable’s size is always 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses. The stored state always occupies 32 or 64 bytes on 32-bit platforms and 64 bytes on 64-bit platforms. One megabyte zone can keep about 32 thousand 32-byte states or about 16 thousand 64-byte states. If the zone storage is exhausted, the server will return the 503 (Service Temporarily Unavailable) error to all further requests.
Please login to continue.