Hi! Not so long ago I started working in my personal server using Proxmox. Then I setup my WordPress server, created SSL certs and added another LXC to run NGINX Proxy Manager (NPM). It was running just fine until some days ago... If I try to open my website I get: 502 Bad Gateway openresty I thought that it was NPM or openresty causing that problem, but I can not find anything wrong there (I'm not an expert in this). I can access NPM, it opens the admin page and I can use it without any problem or limitation. Then I tried to open my website locally: http://my.web.site.ip:80 Somehow it redirects to https but in the end I get: Unable to connect I tried to set my website URL directly in wp-config.php, restart apache2, restart mysql,... Nothing helps... Does anybody know how to fix it and what can cause this issue?
Forum: 

I found the reason why I was getting 502 Bad Gateway...

From all the Linux containers that I have in my Proxmox server, that container was the only one with dynamic IP. All the other ones have Static IP...

So, because I turned off all of my network equipment some days ago, including the router, the IP changed...

I configured the network settings of that container to have static IP and all started to work...

Jeremy Davis's picture

Apologies I've been a bit slower than ideal posting on the forums lately. I try to reply ASAP, although although I'm pretty busy behind the scenes. As much has possible I try to put some time aside to catch up on the forums. Things have been particularly crazy lately and every time I've planned to drop in and answer questions such as yours, I've been interrupted with urgent stuff I've needed to take care of.

Anyway, glad to hear you worked it out.

FWIW a 502 is always an issue connecting to the server. All 50x errors are something behind the front end server. The most common causes are a reverse proxy not being able to connect to the background server (like changed server IP in your case). The other common cause is if something has crashed on the serve itself. Although because we use Apache with mod_php and Apache is some reliable, getting a 502 with a PHP app (like WordPress) are pretty uncommon.

For future use (and anyone else stumbling across this post). The first thing to check with a LAMP based TurnKey server is log in and check that Apache is running:

systemctl status apache2

If all is well, the line starting "Active" should say "active (running)". The next thing to check is that it is listening on the appropriate port/s. Note that some services (such as Apache) only note IPv6, but they are actually listening on IPv4 too. So if Apache is listening publicly on ports 80 (http) and 443 (https) as it should be you'll see those lines in the netstat output:

tcp6       0      0 :::443                  :::*                    LISTEN      4187/apache2        
tcp6       0      0 :::80                   :::*                    LISTEN      4187/apache2 

If both of those look good, then it's almost certainly something external to your server.

Good luck with it all.

Add new comment