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: