These modules are all compiled into Nginx by default unless a module is manually specified to be excluded in configure.
This module can limit the number of simultaneous connections for a session specified by an address or some special circumstances. The following example:
HTTP {limit_zone one $binary _remote_addr 10m; server {location/download/{limit_conn one 1}}}
Instructions
Limit_zone
Syntax: Limit_zone zone_http://www.aliyun.com/zixun/aggregation/11696.html ">name $variable memory_max_size Default value: No Working with Fields: HTTP The instruction describes the session-state storage area. The number of sessions is determined by the variable you specify, depending on the variable size and memory_max_size value used. The following example:
Limit_zone one $binary _remote_addr 10m;
The client's address will be used for the session, noting that the $BINARY_REMOTE_ADDR variable will be used to replace $REMOTE_ADDR. The value of the $remote _addr variable can be 7 to 15 bytes long, so the size is specified as 32 or 64 bytes. The value of the $binary _remote_addr variable is always 4 bytes long and is always 32 bytes in size. 32,000 sessions can theoretically be processed when the session-state storage area is 1M, with each session size of 32 bytes.
Limit_conn
Syntax: Limit_conn zone_name max_clients_per_ip Default value: No Working with fields: HTTP, server, location instruction specifies the maximum number of simultaneous connections for a session, and requests exceeding this number are returned to the Service unavailable (503) code. The following example:
Limit_zone one $binary _remote_addr 10m; server {location/download/{limit_conn one 1;}
This specifies that an address can only have one connection at a time.
Limit_conn_log_level
Syntax: Limit_conn_log_level Info | Notice | Warn | Error Default value: Error Working with fields: HTTP, server, location Log level is recorded when the maximum number of connections is reached.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.