Nginx & Ubuntu: Connection refused while connecting to upstream

Just in case you run into this.

Installed Nginx on mostly vanilla 14.04 trusty Ubuntu. Just walking through the simple Nginx (1.6.0) setup docs with a tail -f running on logs I was seeing the below inconsistent error while using the proxy_pass setting in my server directive.

==> /var/log/nginx/error.log <==
2014/05/11 14:31:50 [error] 4003#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: , server: , request: “GET / HTTP/1.1”, upstream: “http://[::1]:8080/”, host: “”

When I finally realized I was seeing an issue with IPv6, which I don’t use, I disabled it and the error went away.

Disable IPv6 on Ubuntu:
http://www.networkinghowtos.com/howto/disable-ipv6-on-ubuntu/

One thought on “Nginx & Ubuntu: Connection refused while connecting to upstream”

  1. I tried your solution but I still get the same error “[=2014/12/24 13:02:14 [error] 3686#0: *1 connect() to unix:/tmp/unicorn.abc.sock failed (111: Connection refused) while connecting to upstream, client: 2x.x.xx.xx, server: ec2-yy-yy-yy-yyy.compute-1.amazonaws.com, request: “GET /index/ HTTP/1.1”, upstream: “http://unix:/tmp/unicorn.abc.sock:/index/”, host: “ec2-yy-yy-yy-yyy.compute-1.amazonaws.com:4000”

Leave a Reply

Your email address will not be published. Required fields are marked *