Requests hang for exactly 60s then return 504.
The upstream did not answer within proxy_read_timeout (default 60s).
grep " 504 " /var/log/nginx/access.log | awk '{print $7}' | sort | uniq -clocation / { proxy_read_timeout 120s; }SHOW FULL PROCESSLIST; -- MySQLcurl -w "@ Transfer: %{time_total}s\n" -o /dev/null http://127.0.0.1:8000/slow-endpointSet SLOs per endpoint and monitor upstream_response_time in your metrics.
Full walkthrough: NGINX 504 Gateway Timeout: Diagnosis From the Logs Out on the NinjaOps blog.
Spinning up a fresh box to reproduce or escape this error?
Managed cloud hostingNinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.
Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog