# Upstream timed out (110: Connection timed out)

**URL:** <https://www.ruby-forum.com/t/upstream-timed-out-110-connection-timed-out/212039>\
**Category:** NGINX\
**Created:** [September 20, 2011, 5:33pm UTC](https://www.ruby-forum.com/t/upstream-timed-out-110-connection-timed-out/212039 "2011-09-20T17:33:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [September 20, 2011, 5:33pm UTC](https://www.ruby-forum.com/t/upstream-timed-out-110-connection-timed-out/212039/1 "2011-09-20T17:33:27Z")

</div>

## I installed on Debian Lenny nginx 0.6.32 and php-fpm and php file opens as well but went trying to do post request i get error in my /var/log/nginx/error.log “upstream timed out (110: Connection timed out) while reading response header from upstream, …” My config of host

server {  
listen 80;  
server\_name [domain.ru](http://domain.ru) [www.domain.ru](http://www.domain.ru);

set $www\_folder ‘/var/www’;  
set $root\_path ‘$www\_folder’;  
root $root\_path;  
index index.htm index.html index.php;

location ~ .php$ {  
include /etc/nginx/fastcgi\_params;  
fastcgi\_param SCRIPT\_FILENAME $root\_path/$fastcgi\_script\_name;  
fastcgi\_param DOCUMENT\_ROOT $root\_path;  
fastcgi\_pass php-fpm;  
}  
location @phpscripts {  
include /etc/nginx/fastcgi\_params;  
fastcgi\_param SCRIPT\_FILENAME $root\_path/$fastcgi\_script\_name;  
fastcgi\_param DOCUMENT\_ROOT $root\_path;  
fastcgi\_pass php-fpm;  
}

location / {  
default\_type text/html;  
root $root\_path;

```
 if (!-e $request_filename) {
    return 404;
 }

 error_page 404 502 504 403 405 = @php;

```

}

location @php {  
include /etc/nginx/fastcgi\_params;  
fastcgi\_param SCRIPT\_FILENAME $root\_path/index.php;  
fastcgi\_pass php-fpm;  
}

error\_page 502 = /502.htm;  
location = /502.htm {  
root $www\_folder;  
}

location ~\* .(css|js|swf|ico|png|jpg|gif|jpeg|mp3|xml|html)$ {  
root $root\_path;  
access\_log off;  
expires 30d;  
}

location ~ /.ht {  
deny all;  
}

location ~ /.svn/ {  
deny all;  
}

## }

## and my /etc/nginx/nginx.conf

worker\_processes 6;

# worker\_priority -1;

error\_log /var/log/nginx/error.log;  
pid /var/run/nginx.pid;

events {  
worker\_connections 5024;  
# multi\_accept on;  
}

http {  
include /etc/nginx/mime.types;

```
access_log /var/log/nginx/access.log;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    # PHP-FPM (backend)
    upstream php-fpm {
       server 127.0.0.1:9000;
    }

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

```

}

---

<div class="post-metadata">

**Author:** ![devdemi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@devdemi](https://www.ruby-forum.com/u/devdemi)\
**Post date:** [September 20, 2011, 5:37pm UTC](https://www.ruby-forum.com/t/upstream-timed-out-110-connection-timed-out/212039/2 "2011-09-20T17:37:11Z")

</div>

size of post requst is not large, it’s couple kb.  
php script is login form.  
so post request handles very slow.

Posted at Nginx Forum:

> **[Re: upstream timed out (110: Connection timed out)](https://forum.nginx.org/read.php?2,215447,215448#msg-215448)**
>
> I installed on Debian Lenny nginx 0.6.32 and php-fpm and php file opens as well but went trying to do post request i get error in my /var/log/nginx/error.log "upstream timed out (110: Connection timed out) while reading response header from...

---

<div class="post-metadata">

**Author:** ![devdemi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@devdemi](https://www.ruby-forum.com/u/devdemi)\
**Post date:** [September 20, 2011, 6:02pm UTC](https://www.ruby-forum.com/t/upstream-timed-out-110-connection-timed-out/212039/3 "2011-09-20T18:02:35Z")

</div>

> php script is login form.  
> so post request handles very slow.

What does the php-fpm log show?

If its not enabled see where is your ‘php-fpm.conf’ is and under:

[global]  
error\_log = /path/to/your/php-fpm.log  
slowlog = /path/to/your/slow.log

Optionaly (if not present) add something like:

request\_slowlog\_timeout = 10s

(it will log/backtrace all php requests which take longer than 10  
seconds).

rr

---

<div class="post-metadata">

**Author:** ![devdemi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@devdemi](https://www.ruby-forum.com/u/devdemi)\
**Post date:** [September 20, 2011, 6:03pm UTC](https://www.ruby-forum.com/t/upstream-timed-out-110-connection-timed-out/212039/4 "2011-09-20T18:03:50Z")

</div>

> Optionaly (if not present) add something like:  
> request\_slowlog\_timeout = 10s

Of course after the changes restart php-fpm.

rr
