Any way to deal with clients breaking the limit zone

Maxim Dounin mdounin at mdounin.ru
Thu Jan 12 16:11:29 UTC 2012


Hello!

On Wed, Jan 11, 2012 at 04:31:45PM -0500, locojohn wrote:

> Hello Maxim,
> 
> Sorry about highjacking this thread, but I think my question is
> relevant.  In the nginx configuration I have:
> 
>         # limit simultaneous connections
>         limit_conn_zone $binary_remote_addr zone=addr:1m;
>         limit_conn addr 16;
> 
> But the error_log file says:
> 
> 2012/01/11 21:41:39 [warn] 10140#0: *2959 limiting connections by zone
> "addr", client: 127.0.0.1, server: , request: "GET / HTTP/1.0", host:
> "mysite.com", referrer: "http://code.google.com/p/slowhttptest/"
> 2012/01/11 21:41:40 [warn] 10140#0: *2962 limiting connections by zone
> "addr", client: 127.0.0.1, server: , request: "GET / HTTP/1.0", host:
> "mysite.com", referrer: "http://code.google.com/p/slowhttptest/"
> 
> Question is, why 127.0.0.1 for the remote client address?  It should
> have nothing to do with loopback host address.   It must be external
> IP.

Obvious reason is: because connection was got from 127.0.0.1.

> Any workaround?   Also, I noticed that "server:" is empty.   Any other
> reason for that?   I have a dozen of virtual hosts configured with
> fastcgi_pass to php-fpm.

Obvious reason is: the request was matched by a server{} block 
without server_name set.  See here:

http://nginx.org/en/docs/http/request_processing.html

for more details on how nginx matches requests to servers.

Maxim Dounin



More information about the nginx mailing list