I have lot of times the following line appearing in the nginx error log. This is causing the 50x error appearing to the visitors of the site. We have a multilanguage site that has URL language.example.com
[error] 25720#0: *2716 limiting connections by zone "slimits", client: 127.0.0.1, server: localhost, request: .......
The client is always appearing as 127.0.0.1 which is quite suspicious.
There is a load balancing in place that is using the localhost and also another server. The upstream nginx config:
upstream example.com {
server 127.0.0.1:8082 weight=3 max_fails=3 fail_timeout=2;
server otherserver.example.net:8082 max_fails=3 fail_timeout=2;
}
The slimit value is now set to 40
limit_conn slimits 40;
As far as I know this limit is supposed to be the limit of connections that a REMOTE user should be able to open. I guess that the IP address of the remote user is not passed correctly to the nginx down the line.
And this is the sites definition:
server {
listen 80 default_server;
server_name localhost;
allow all;
}
server {
listen 80;
server_name *.example.com;
# stop subdomains like everything.example.com
deny all;
}
server {
listen 80;
server_name server.com www.example.com;
location / {
proxy_pass http://example.com;
}
}
server {
listen 80;
server_name fr.example.com;
location / {
proxy_pass http://fr.example.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Nginx version is: 1.0.12.