upstream timed out

OlivierC nginx-forum at
Fri Apr 13 08:59:55 UTC 2012


I'm the new admin of a website and its servers. I have a frontend nginx
proxy server and an Apache backend.
I sometimes have errors :

2012/04/12 17:44:33 [error] 13442#0: *74193485 upstream timed out (110:
Connection timed out) while reading response header from upstream,
client:, server: www.mysite.tld, request: "POST /my/url
HTTP/1.1", upstream: "", host:
"www.mysite.tld", referrer: "https://www.mysite.tld/another/url"
2012/04/12 17:44:33 [error] 13442#0: *74193485 no live upstreams while
connecting to upstream, client:, server: www.mysite.tld,
request: "POST /my/url HTTP/1.1", upstream: "http://backend/my/url",
host: "www.mysite.tld", referrer: ""

(I've juste anonymized the urls and ip addresses)

Here are the configuration files :

conf.d/proxy.conf :

proxy_redirect                  off;
proxy_set_header                Host            $host;
proxy_set_header                X-Real-IP       $remote_addr;
proxy_set_header                X-Forwarded-For
proxy_set_header                X-Forwarded-Proto $scheme;
client_max_body_size            32M;
client_body_buffer_size         256k;
client_header_buffer_size       128k;
proxy_connect_timeout           30;
proxy_send_timeout              30;
proxy_read_timeout              30;
proxy_buffer_size               32k;
proxy_buffers                   64   32k;
proxy_busy_buffers_size         128k;

conf.d/loadbalancer.conf :

upstream backend {
    # web1
#    server backup;
    # web2
    server down;

sites-enabled/mysite.conf :

server {
        listen       80;
        listen       443 ssl;
        server_name  www.mysite.tld www3.mysite.tld;

        access_log off; #/home/nginx/log/mysite.access.log;
        #error_log  /dev/null crit;

        # Possible level values : debug | info | notice | warn | error |
        error_log /home/nginx/log/mysite.error.log notice;
        log_not_found off;

        #set $proto "http";
        #if ( $server_port = "443" ) {
         #set $proto "https";

        # serve static files directly
        location ~*
^.+\.(jpg|jpeg|gif|css|png|js|ico|html|pdf|zip|tgz|gz|bz2|swf)$ {
                expires         10d;
                root            /home/mysite/www;

        location / {
                #proxy_set_header X-Forwarded-Proto $proto;
                proxy_pass       http://backend;
                add_header       X-Whom candidature at mysite.tld;

        error_page 405 = $uri;
        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
                root /home/mysitewww;

       location = /favicon.ico { access_log off; log_not_found off; }

The problem seems to be recent and sometimes happens immediatly after
clients have paid through the bank online credit card form which is
integrated (we do not redirect to the bank website). It's a real problem
for us since when it happens at that moment, clients think their order
and paiement have not been saved and they order a second time (and also
pay a second time).

I don't really know what i'm looking for : can it be a network
connection problem between frontend and backend servers ? Is it because
of the configuration of the proxy of the server ? or... ?

Thanks for any help.

Posted at Nginx Forum:,225289,225289#msg-225289

More information about the nginx mailing list