502 Bad Gateway (Nginx) Issue

After uninstalling PHP (7.0.33-58+ubuntu18.04.1+deb.sury.org+1) package and reboot the server as per recommendation from Linode support as to have the newer version of PHP 7.4 to take control, the website is not longer accessible due to "502 Bad Gateway(nginx)" error. I've tried installing back PHP 7.0 package back but the issue still persist.

Troubleshooting done:

  1. Nginx service is running - Tried restarting/reloading the service

  2. Apache service is not running at the same time

  3. Nginx is listening to port 443 and 80

  4. Php7.0-fpm service is running - Tried restarting/reloading the service

  5. Php7.4-fpm service is running - Tried restarting/reloading the service

I've tried stopping php7.0-fpm and php7.4-fpm service running at the same time enabling each version at a time. However, that also didn't resolve the issue.

How do I fix this?

1 Reply

Do php70-fpm & php74-fpm use the same socket/port? Do you use the same nginx (boilerplate) config to interface with both of them? Does nginx interface with them at all?

You only need one of these…the one that matches your chosen php version.

Just FYI, if you’re after the latest & greatest, php is up to 8.1 now. I’ve read/heard that new(er) versions of WP require php 8.0 or better these days.

—sw

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