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.

1 Reply

Hey there,

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:

netstat -plunt

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.

Sincerely,
Tara T
Linode Support Team

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct