How can i fix a 502 bad gateway?
Hello everybody !
I have a big problem !!
After a Linode restore, the web server is down
i'm getting a "502 bad gateway" response
I tried to restart nginx but it can't find it..!
Any suggestions how to fix the problem?
Thank you in advance.
There are a number of commands that we can run to determine if a Linode’s networking interfaces are brought up properly after a reboot.
cat /etc/network/interfaces systemctl status networking.service ip a ip r
If you aren't having any additional networking issues, you can locate all of your Nginx related files and directories with the following to determine if it's still present on the system following your restore:
find -L . -name '*nginx*' sudo find / -type d -name 'nginx'
Thhis will produce a lot of output if nginx is present. You don't need to parse through all of the files. If Nginx is still present, I'd recommend running the following troubleshooting commands from your Linode's terminal (or the Lish console):
To check the status of Nginx:
systemctl status nginx
To check which services are listening on which ports:
If Nginx isn't running, or if another service is listening on port 80, you'll need to kill off that process (assuming it's one you don't need) and start Nginx in its place:
systemctl start nginx
Here is another Community Post that addresses troubleshooting Nginx.
We've seen other customers have issues serving websites when they have both apache and Nginx installed and misconfigured. You can check for apache on your system with the following:
systemctl status apache2.service
If Nginx is not on the system at all, you may need to reinstall.
We hope that helps. Let us know if it moved your troubleshooting forward towards a resolution.
Linode Support Team