A 504 means the front server waited for your site to answer and gave up. The request reached your host. Your site's program started working on it and took too long. Something is slow, not gone.
mysqladmin processlist and look for queries running for many seconds. On shared hosting, ask support whether your account is hitting CPU or process limits.wp-content/plugins to plugins-off over FTP. If the site answers, turn plugins back on one at a time.sudo tail -50 /var/log/nginx/error.log. "upstream timed out (110: Connection timed out)" confirms the app was too slow. Raising fastcgi_read_timeout hides the symptom. Fix the slow part first.Run curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://yourdomain.com. It prints the status and how many seconds the answer took. Anything over five seconds on a plain page is worth fixing before it becomes a 504.
Want the rest of your site checked after it is back? Run a free 40-point check at tinkeraudit.com.