504 Gateway Timeout Checklist for Nginx WordPress
A 504 Gateway Timeout usually means Nginx waited too long for the backend to respond. On a WordPress VPS, the backend is often PHP-FPM, MySQL or a slow WordPress process.
Common causes
- PHP-FPM is overloaded or stopped.
- MySQL is slow or unavailable.
- VPS RAM or CPU is exhausted.
- A plugin creates slow requests.
- Bot traffic overloads the website.
- Nginx or PHP timeout values are too low for the workload.
Checklist
- Check if the whole website is down or only one URL.
- Test Nginx configuration.
- Check Nginx service status.
- Check PHP-FPM status.
- Check MySQL or MariaDB status.
- Check RAM, CPU and disk usage.
- Read Nginx error log.
- Read access log for bot spikes.
- Review recent WordPress plugin changes.
- Restart services only after checking the logs.
- Monitor the site after recovery.
Final check
Do not treat restart as the full solution. Restart can bring the website back temporarily, but the real fix comes from identifying the bottleneck in logs and server resources.
Estimated Time
Use Case
Use this checklist when a WordPress site behind Nginx returns 504 Gateway Timeout.
Common Mistakes
- Restarting everything without reading logs.
- Increasing timeout without fixing slow backend.
- Ignoring bot traffic.
- Forgetting to check disk usage.
- Blaming Nginx when MySQL is the real bottleneck.
Related Commands
sudo nginx -t
sudo systemctl status nginx
sudo systemctl status php8.2-fpm
sudo systemctl status mysql
free -h
df -h
top
sudo tail -n 100 /var/log/nginx/error.log
sudo tail -n 100 /var/log/nginx/access.log