changeset 207:2df68271c898

Provided an example of using several "limit_conn" directives.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 28 Nov 2011 07:18:22 +0000
parents b7323871813e
children a4a935c52b62
files xml/en/docs/http/ngx_http_limit_conn_module.xml xml/ru/docs/http/ngx_http_limit_conn_module.xml
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_limit_conn_module.xml
+++ b/xml/en/docs/http/ngx_http_limit_conn_module.xml
@@ -61,7 +61,7 @@ When this limit is exceeded, the server 
 in reply to a request.
 For example, the directives
 <example>
-limit_conn_zone $binary_remote_addr zone=addr:10m;
+    limit_conn_zone $binary_remote_addr zone=addr:10m;
 
     server {
         location /download/ {
@@ -74,6 +74,20 @@ allow for only a single connection at a 
 <para>
 When several <code>limit_conn</code> directives are specified,
 any configured limit will apply.
+For example, the following configuration will limit the number
+of connections to the server per client IP and at the same time
+will limit the total number of connections to the virtual host:
+<example>
+    limit_conn_zone $binary_remote_addr zone=perip:10m;
+    limit_conn_zone $server_name zone=perserver:10m;
+
+    server {
+        ...
+        limit_conn perip 10;
+        limit_conn perserver 100;
+    }
+</example>
+
 </para>
 
 <para>
--- a/xml/ru/docs/http/ngx_http_limit_conn_module.xml
+++ b/xml/ru/docs/http/ngx_http_limit_conn_module.xml
@@ -60,7 +60,7 @@ http {
 <http-status code="503" text="Service Temporarily Unavailable"/>.
 Например, директивы
 <example>
-limit_conn_zone $binary_remote_addr zone=addr:10m;
+    limit_conn_zone $binary_remote_addr zone=addr:10m;
 
     server {
         location /download/ {
@@ -74,6 +74,20 @@ IP-адреса.
 <para>
 Допустимо одновременное указание нескольких директив <code>limit_conn</code>,
 при этом будет срабатывать любое из ограничений.
+Например, следующая конфигурация ограничивает число соединений с сервером
+с одного клиентского IP-адреса и в то же время ограничивает общее число
+соединений с виртуальным хостом:
+<example>
+    limit_conn_zone $binary_remote_addr zone=perip:10m;
+    limit_conn_zone $server_name zone=perserver:10m;
+
+    server {
+        ...
+        limit_conn perip 10;
+        limit_conn perserver 100;
+    }
+</example>
+
 </para>
 
 <para>