A user is troubleshooting a 502 Bad Gateway error while installing Discourse on CentOS 7, with issues related to nginx configuration and Docker port forwarding. Initially, the problem was due to a missing IPv6 listen statement in the nginx server block, which was resolved by griffin. After fixing the connection issue, the user encountered a redirect to “Welcome to CentOS” and a “version NOT FOUND” error from Discourse doctor. The user suspects the issue may stem from using Docker socket-based configuration and port forwarding, referencing tutorials that recommend different setups. Falco advises that such advanced configurations are complex and recommends using the official Discourse Standard Installation for a simpler setup, especially for those unfamiliar with reverse proxies and Docker networking.
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.
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 officialDiscourse Standard Installation. That does assume a brand new server and that Discourse is the only web app in there.