502 Bad Gateway - nginx/1.14.0 (Ubuntu)

naupe nginx-forum at forum.nginx.org
Sun Nov 17 11:40:36 UTC 2019

Recently I moved my Dell Server from one location to another, with a
completely different Router. Its Main OS/VM Manager is Proxmox VE 5.3. I got
an Nginx VM that is Reverse Proxying several other VMs.

After configuring my new Router, I got several of my VMs to connect to the
Internet (setting the same Private IPs to the same MAC Addresses, and
opening the same ports for the same Private IPs). However, with my Discourse
VM, I am receiving 502 Bad Gateway - nginx/1.14.0 (Ubuntu) when trying to
access Discourse in a Browser.

In the past, it was usually through the Discourse software that I could fix
the problem ... but not so this time. Please read here for more details:

I've basically hit a point where I believe the issue is with the
configuration of the Nginx VM. Recently I've tried renewed the SSL
Certificates (using Let's Encrypt) for all my sites on Nginx, hoping it
would fix the problem ... but it didn't. However, I checked the Nginx Error
Log and found a message being reported over and over again:

> root at ngx:/etc/nginx/sites-available# less /var/log/nginx/error.log
> 2019/11/17 06:01:24 [error] 23646#23646: *37 connect() failed (111:
Connection refused) while connecting to upstream, client:, server:
discourse.domainame.com, request: "GET / HTTP/2.0", upstream:
"", host: "discourse.domainame.com"

* = My Old Public IP Address
* = My New Public IP Address

It looks to me like Nginx is trying to connect this site using my Old Public
IP Address. That is definitely incorrect.
My /etc/nginx/sites-available CONF file for the Discourse Site can be found
in THIS link: https://pastebin.com/fiiyATeP

* = Nginx VM
* = Discourse VM


So my question is: How can I tell Nginx to connect discourse.domainname.com
to my New Public IP Address

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,286226,286226#msg-286226

More information about the nginx mailing list