config
Nginx 504 Gateway Timeout
504 Gateway Time-?out|upstream timed out.*reading response
Fixes
- 1.Increase proxy_read_timeout (default 60s): proxy_read_timeout 300s
- 2.Optimize the backend endpoint that's taking too long to respond
- 3.Add proxy_buffering off for streaming endpoints, or increase proxy_buffer_size for large headers
nginx504timeout
Related Errors
config3 fixes
Nginx 502 Bad Gateway - upstream unavailable
502 Bad Gateway|upstream prematurely closed connection
- •Verify the upstream server is running and listening on the expected address/port
- •Increase proxy_read_timeout and proxy_connect_timeout for slow backends
config3 fixes
Nginx redirect loop
rewrite or internal redirection cycle|return 301.*too many redirects
- •Check for conflicting rewrite rules that redirect back and forth (HTTP→HTTPS→HTTP)
- •Use 'return 301' instead of 'rewrite' for simple redirects to avoid rule interaction
config3 fixes
Nginx SSL certificate loading error
SSL_CTX_use_PrivateKey.*failed|cannot load certificate
- •Verify the certificate file path and that nginx user has read permission
- •Ensure the certificate file contains the full chain (server cert + intermediates) in PEM format