502 Bad Gateway. A server acting as a gateway or proxy received an invalid response message from an upstream server. Introduced in HTTP/1.0. How to solve a problem? Most likely, if the website used to work and now does not open, it is not a matter of the environment configuration. Often the reason is the lack of server resources, and therefore the inability to serve all clients. In particular, the problem may be a lack of RAM. This can happen both on a VPS and on shared hosting. If PHP works through FastCGI, then the server may lack php-cgi processes at times when there are many visitors to the website, a gluttonous bot has decided to come, or someone zealously downloads your entire website for offline study. The web server would like to start additional processes, but there is no more memory for them. This means you need to add memory or optimize the consumption of available memory. If the top command shows that there is memory, it may be due to the set limits on the number of php-cgi processes. You need to look at the Apache configuration files (httpd.conf), especially the section of the module responsible for FastCGI (mod_fascgi or mod_fastcgid).