NGINX
upstream timed out
error 110
operation timed out
server configuration

NGINX upstream timed out 110 Operation timed out

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

The NGINX error upstream timed out (110: Operation timed out) means NGINX did not receive a response from the upstream service quickly enough. The fix is rarely just "raise the timeout and move on." You need to identify whether the real problem is slow application code, overloaded infrastructure, network latency, or a timeout setting that is too short for legitimate requests.

What The Error Means

In a reverse-proxy setup, NGINX accepts a client request and forwards it to an upstream server such as:

  • a Node or Python app
  • a PHP-FPM process
  • a Java service
  • another HTTP backend

If that upstream does not connect, respond, or finish sending data within the configured time limits, NGINX logs a timeout.

Typical log line:

text
upstream timed out (110: Operation timed out) while reading response header from upstream

The phrase after it matters. Timing out while connecting is different from timing out while reading the response.

Know Which Timeout You Are Hitting

These directives control different parts of the request flow:

nginx
1location / {
2    proxy_pass http://app;
3    proxy_connect_timeout 5s;
4    proxy_send_timeout 30s;
5    proxy_read_timeout 30s;
6}
  • 'proxy_connect_timeout: how long NGINX waits to connect to the upstream'
  • 'proxy_send_timeout: how long NGINX waits while sending the request to the upstream'
  • 'proxy_read_timeout: how long NGINX waits to read the upstream response'

If the error says it timed out while reading the response header, proxy_read_timeout is the most directly relevant setting. But raising it blindly only hides the symptom if the app is actually stuck.

First Check The Upstream Application

Most upstream timeout issues are application-side.

Common causes:

  • slow database queries
  • expensive report generation
  • blocking external API calls
  • thread pool exhaustion
  • worker process overload

If a request routinely needs 45 seconds because of a bad SQL query, increasing NGINX from 30 seconds to 60 seconds may stop the error while leaving the real performance problem untouched.

This is why app logs and backend metrics matter more than the NGINX directive names alone.

A Reasonable NGINX Adjustment

If the request is legitimately long-running and the backend is healthy, adjusting the timeout may be appropriate.

nginx
1upstream app {
2    server 127.0.0.1:8080;
3}
4
5server {
6    listen 80;
7
8    location / {
9        proxy_pass http://app;
10        proxy_connect_timeout 5s;
11        proxy_send_timeout 60s;
12        proxy_read_timeout 60s;
13    }
14}

After updating the config, test it:

bash
nginx -t

Then reload:

bash
nginx -s reload

This is the operational sequence you want. Never reload before the config test passes.

Do Not Ignore Upstream Capacity

Even healthy code can time out if the upstream is overloaded.

Check for:

  • CPU saturation
  • memory pressure
  • too few backend workers
  • connection pool exhaustion
  • overloaded database connections

In those cases, NGINX is often just the messenger. The backend is slow because it is busy or starved.

A timeout error during peak traffic is often a capacity problem rather than a broken timeout number.

Network And Load Balancer Effects

Sometimes the backend is fine, but the path between NGINX and the upstream is unstable.

Possible issues:

  • packet loss
  • DNS resolution problems
  • cross-zone or cross-region latency
  • internal load balancer instability

If the upstream is remote rather than local, confirm the network path before assuming the application itself is the bottleneck.

Long Requests May Need A Different Design

If the application sometimes performs operations that genuinely take a long time, consider whether synchronous HTTP is the right interface.

A better design can be:

  • return quickly with a job ID
  • process work asynchronously
  • let the client poll or subscribe for status

This avoids holding NGINX, the app server, and the client connection open during long background operations.

Timeout increases are often a short-term patch. Asynchronous workflow redesign is often the long-term fix.

Common Pitfalls

The biggest mistake is raising proxy_read_timeout without checking upstream logs. That may silence NGINX errors while leaving the application slow or unhealthy.

Another mistake is changing the wrong timeout directive. A connect timeout, send timeout, and read timeout solve different failure modes.

People also forget to test and reload the NGINX config properly. A typo in the config can turn one production problem into a bigger one.

Finally, if the backend workload is naturally long-running, repeatedly stretching timeouts can be a sign that the request should be redesigned as asynchronous work instead.

Summary

  • 'upstream timed out (110) means NGINX waited too long for the upstream at some stage of the proxy flow.'
  • Identify whether the timeout happened during connect, send, or read.
  • Most real fixes involve backend performance, capacity, or network investigation, not only NGINX tuning.
  • Adjust proxy_*_timeout values only when the request duration is legitimate and understood.
  • Long-running work may be better handled asynchronously instead of through a long-held HTTP request.

Course illustration
Course illustration

All Rights Reserved.