HttpLimitZoneModule
Contents |
[edit] Synopsis
This module makes it possible to limit the number of simultaneous connections for the assigned session or as a special case, from one address.
Example configuration
http { limit_zone one $binary_remote_addr 10m; server { location /download/ { limit_conn one 1; } } }
[edit] Directives
[edit] limit_zone
syntax: limit_zone zone_name $variable memory_max_size
default: no
context: http
Directive describes the zone, in which the session states are stored.
The numbers of sessions is determined by the assigned variable, it depends on the size of the used Variable and memory_max_size value.
Example of the use:
limit_zone one $binary_remote_addr 10m;
The address of client is used as the session.
Notice that the variable $binary_remote_addr is used instead of $remote_addr.
The length of the values of the variable of $remote_addr can be from 7 to 15 bytes; therefore size state is equal to 32 or 64 bytes.
Length of all values of the variable of $binary_remote_addr is always 4 bytes and the size of the state is always 32 bytes.
When the zone size is 1M then it is possible to handle 32000 sessions with 32 bytes/session.
[edit] limit_conn
syntax: limit_conn zone_name max_clients_per_ip
default: no
context: http, server, location
Directive assigns the maximum number of simultaneous connections for one session. With exceeding of this number the request completes by the code "Service unavailable" (503).
For example, the directive:
limit_zone one $binary_remote_addr 10m; server { location /download/ { limit_conn one 1; }
This allows not more than one simultaneous connection from one address.
[edit] limit_conn_log_level
syntax: limit_conn_log_level info | notice | warn | error
default: error
context: http, server, location
Sets the error log level used when a connection limit is reached









