502 Bad Gateway errors from Nginx when trying to access Tomcat

Francis Daly francis at daoine.org
Sat Apr 23 07:50:37 UTC 2016


On Fri, Apr 22, 2016 at 02:29:07AM -0400, gischethans wrote:

Hi there,

> I have JIRA and Nginx running on the same server with Nginx installed to
> serve as a reverse proxy.

For this to work, you need your users to connect to nginx, and you need
nginx to connect to jira.

> Browser displays Connection refused / connection timed out
> errors.

To aid debugging, can you make sure that one specific nginx config is
being used, run

  curl -i http://nginx-server/

and paste the result here?

That should show whether this config leads to a "refused" or a "timed out"
-- they are different errors, with different causes.

> Trying to access the site through curl gives me 502 Bad gateway
> error. I have also checked the Nginx error log which shows this - 

"bad gateway" is a different error, with a different cause.

> connect() failed (111: Connection refused) while connecting to upstream,
> client: <IP Address>, server: <FQDN>, request: "GET / HTTP/1.1", upstream:
> "http://<IP>:8080/", host: <FQDN>

That is good; it suggests that your user is connecting to nginx.

It appears that nginx is not connecting to jira.

You have jira/tomcat listening on 127.0.0.1:8080.

<IP> above should be exactly 127.0.0.1. That comes from...

>                 proxy_pass http://<IP>:8080/; #Here I have tried the real IP

<IP> there should be exactly 127.0.0.1.

Make that one change; make sure your new nginx.conf is being used,
test again, and report if anything is imperfect.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list