502 Bad Gateway and Discourse version NOT FOUND

I’ve followed instructions to install Discourse on Centos 7

I set up email correctly and got a test email. But I always get 502 Bad Gateway.

I previously had an issue with ssl_stapling that I resolved by including the full chain cert file.

I see the docker app listening on custom defined port 25654:

0.0.0.0:25654->80/tcp, :::25654->80/tcp

I get these nginx errors that I think are caused by discourse app not listening.

connect() failed (111: Connection refused) while connecting to upstream, client: x.x.x.x, server: xxxx, request: “GET / HTTP/2.0”, upstream: “http://x.x.x.x:25654/”, host: “xxxx”

I have DNS entries that point both [MY_DOMAIN].net and discourse.[MY_DOMAIN].net to the right IP address.

1 Like

Welcome to the Meta Discourse Community :slightly_smiling_face:

I often help out with SSL installation issues in the Let’s Encrypt Community. One thing I noticed is that your second server block is missing the IPv6 listen statement:

listen [::]:443 ssl http2;

Without that, I’m not sure where your IPv6 traffic would end up.

:man_shrugging:

1 Like

Thanks very much, Jonathan. This solved the issue of connection refused.

Now when I try my discourse URL I get redirected to the “Welcome to CentOS” and I have the following error log.

Discourse doctor still says version NOT FOUND.

1 Like

I see using netstat that I have two docker-proxy processes on port 25654, one for tcp and one for tcp6. I wonder if this is a problem because I don’t see this in other tutorials’ screenshots.

Because Centos seems to require a different setup I followed the nginx settings in this tutorial:

I also made some additional changes to app.yml and nginx conf that I saw in this tutorial because I want to have my MYDOMAIN.net and discourse.MYDOMAIN.net run on the same machine through nginx:

For instance I have the web socket template activated.

But now I read in a comment on that tutorial that if you use the socket then you must comment out all exposed ports, though going by the first config added an entry for “25654:80” so that it listens for the traffix forwarded to 25654 by nginx.

Apologies if this is a basic setup issue, port forwarding/sockets and network setup in general are not my strength.

Those are advanced setups. For people not experienced with setting up reverse proxies and managing docker we recommend following our only official Discourse Standard Installation. That does assume a brand new server and that Discourse is the only web app in there.

3 Likes