502 bad gateway error

[ad_1]

I get this error almost on every page but when I refresh it, it always works on the second try.

Here's what the error logs say: [error] 36903#36903: *6006 FastCGI sent in stderr: "usedPHP message: Connection refusedPHP

I have a lightsail instance with Linux/Unix Ubuntu server running nginx with mysql and php-fpm for a WordPress site. I installed redis and had a lot of problems so I removed it and I'm thinking the error is related to this.

[ad_2]
2 Comments
  1. What size Lightsail instance? You’ve probably run out of memory. Redis would exacerbate that problem. Have you looked at `top`?

  2. The “502 Bad Gateway” error you’re encountering is a common issue in Nginx when there is a problem with the communication between Nginx and the backend service, in your case, PHP-FPM.

    Ensure that PHP-FPM is running by running this command: sudo systemctl status php7.4-fpm
    Restart the PHP-FPM service using this command: sudo systemctl restart php7.4-fpm

    PS: change the php version to what you have installed.

    Also, Ensure that the “fastcgi_pass” directive in your Nginx configuration is pointing to the correct PHP-FPM socket which is:
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer