Nginx "Connection refused" error when setting upstream as localhost

For some reason, I checked out the nginx error log last night and got this error:

2014/10/28 06:53:54 [error] 5437#0: *28 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.3, server: my.domain.com, request: "GET /staff/acts/report-by-acts/ HTTP/1.1", upstream: "http://[::1]:8080/staff/acts/report-by-acts/", host: "my.domain.com", referrer: "http://my.domain.com/staff/families/all/"

But my web application is still working properly. What happened? Where was the problem?

I looked into the nginx configuration and found that I set upstream server of that app as localhost:

upstream asa {
    server localhost:8080 fail_timeout=0;
}


So, I changed the server directive to 127.0.0.1, restart nginx, and the error gone away:

upstream asa {
    server 127.0.0.1:8080 fail_timeout=0;
}

Comments