# upstream timed out (110: Connection timed out) while connecting to upstream, client: 10.0.0.1, server: example.com, upstream: "http://127.0.0.1:8080"

- **ID:** `nginx/upstream-timed-out-110-connection-timed-out-while-connecting-to-upstream`
- **Domain:** nginx
- **Category:** timeout_error
- **Error Code:** `110`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Nginx cannot establish a TCP connection to the upstream server because the server is unreachable, firewalled, or overloaded, causing the connection attempt to exceed the proxy_connect_timeout.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| nginx 1.24.0 | active | — | — |
| nginx 1.22.1 | active | — | — |
| nginx 1.20.2 | active | — | — |
| nginx 1.18.0 | active | — | — |

## Workarounds

1. **Increase proxy_connect_timeout to allow more time for connection:
proxy_connect_timeout 30s;
Also verify upstream reachability: telnet 127.0.0.1 8080
Check firewall rules: iptables -L -n | grep 8080** (80% success)
   ```
   Increase proxy_connect_timeout to allow more time for connection:
proxy_connect_timeout 30s;
Also verify upstream reachability: telnet 127.0.0.1 8080
Check firewall rules: iptables -L -n | grep 8080
   ```
2. **Add upstream server health checks and remove unhealthy servers:
upstream backend {
    server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
    server 10.0.0.2:8080 backup;
}
This allows nginx to skip unresponsive servers.** (75% success)
   ```
   Add upstream server health checks and remove unhealthy servers:
upstream backend {
    server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
    server 10.0.0.2:8080 backup;
}
This allows nginx to skip unresponsive servers.
   ```
3. **Check if the upstream server is running and listening:
systemctl status myapp
netstat -tlnp | grep 8080
Restart the upstream service if needed.** (90% success)
   ```
   Check if the upstream server is running and listening:
systemctl status myapp
netstat -tlnp | grep 8080
Restart the upstream service if needed.
   ```

## Dead Ends

- **** — The timeout occurs during the TCP handshake, not during data transfer; these settings do not affect connect timeout. (60% fail)
- **** — The error is at the transport layer; protocol version is irrelevant. (40% fail)
- **** — Keepalive only helps after a connection is established; it does not prevent connection timeouts. (30% fail)
