A 502 means the front server answered, but the program behind it did not. The web server (often nginx, Cloudflare or your host's proxy) asked your site's app for the page and got nothing useful back. Your files are usually fine. Something stopped running.
sudo systemctl restart php8.2-fpm (or your PHP version), or restart your Node or Python service. On shared hosting, open a ticket and ask them to check PHP-FPM.sudo tail -50 /var/log/nginx/error.log. "Connection refused" means the app is not running. "upstream timed out" means it is too slow. "upstream sent too big header" means a buffer setting is too small.wp-content/plugins to plugins-off over FTP. If the site comes back, rename it back and turn plugins on one by one.free -m. If free memory is near zero, add swap or a bigger plan.Run curl -sI https://yourdomain.com. The first line shows the status. A server: line saying cloudflare tells you the error passed through Cloudflare.
Want the rest of your site checked after it is back? Run a free 40-point check at tinkeraudit.com.