Nginx: upstream prematurely closed connection
Backend closed the TCP socket before sending a complete HTTP response header.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.0.0
Identifier: Nginx: upstream prematurely closed connection
Platform: Nginx
Interactive Diagnostic Checklist
Safe Diagnostic Command:
tail -n 50 /var/log/nginx/error.log && ss -tlnp
Technical Explanation
Backend closed the TCP socket before sending a complete HTTP response header. Verified resolution path: Inspect backend crash/OOM logs and match upstream keepalive_timeout with Nginx proxy_read_timeout.
Worked Examples
- Read-only diagnostic command: tail -n 50 /var/log/nginx/error.log && ss -tlnp
Limitations & Assumptions
- Always verify which infrastructure layer (CDN, Nginx, runtime, OS, or database) emitted the error before modifying production config.
Source References & Verification
Resource ID: err-nginx-upstream-prematurely-closed · Independently verified: 2026-11-25