If your site is suddenly inaccessible with the following message: 502 Bad Gateway, Nginx 1.62 (or other version), then it means that Nginx is malfunctioning or has been activated while you were using Apache. It is therefore necessary to check the Nginx error messages (var / log / nginx / error.log) or to disable Nginx and then reactivate Apache.
In the last case, there was a strange problem that triggered Nginx and put aside Apache.
Nginx has to be reactivated, you have to delete it, and restart Apache:
sudo service nginx stop sudo apt-get remove nginx sudo apt-get remove nginx-core sudo apt-get remove nginx-* sudo apt-get purge nginx-*
sudo apache2ctl restart (httpd disabled, trying to restart httpd) sudo apache2ctl restart
/etc/init.d/apache2 restart /etc/init.d/mysql restart
Your website should be finally back online.
It is especially true if your monitoring traffic on your web hosting interface (like OVH Cloud interface) shows a high uncommon traffic.