nginx-1.1.8

Delta Yeh delta.yeh at gmail.com
Fri Nov 25 10:50:25 UTC 2011


So if I want to limit total connection to one uri, I can do it by:


limit_conn_zone $host$uri zone=peruri:10m;


    server {
        ...
        location / {
            limit_conn peruri 10;
      }

    }


but because uri is

2011/11/25 Maxim Dounin <mdounin at mdounin.ru>:
> Hello!
>
> On Fri, Nov 25, 2011 at 11:03:39AM +0800, Delta Yeh wrote:
>
>> 2011/11/14 Igor Sysoev <igor at sysoev.ru>:
>> > Changes with nginx 1.1.8                                         14 Nov 2011
>> >
>> >    *) Change: the ngx_http_limit_zone_module was renamed to the
>> >       ngx_http_limit_conn_module.
>> >
>> >    *) Change: the "limit_zone" directive was superseded by the
>> >       "limit_conn_zone" directive with a new syntax.
>> >
>> >    *) Feature: support for multiple "limit_conn" limits on the same level.
>> >
>>
>>  Usually we use   limit_zone module like:
>> http{
>>
>>  limit_zone   one  $binary_remote_addr  10m;
>> server
>> {
>>    location /mypage{
>>       limit_conn   one  number_of connections;
>>   }
>> }
>>
>> What is the  scenario that we should use multiple limit_conn ?
>
> E.g. if you want to limit number of connections per ip *and* total
> number of connections per virtual host.
>
>    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;
>    }
>
>> Is there a way to limit total connections to one location ?
>
> Yes.
>
> Maxim Dounin
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list