Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently shifted my server to nginx and php-fpm getting rid of apache. This has helped improves speeds of my website.

Everything seems to work fine until i came across this issue, i noticed that nginx keeps throwing connection time out errors for only certain IPs. One of the IPs is my office IP, we have a backend that is accessed from our office through out the day.

I use supervisord to launch 3 php-fpm processes with workers this is my typical php-fpm config

pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 300

Since i have a server with 4 cores and 2 GB ram this is my nginx setup

worker_processes  4;
worker_rlimit_nofile 8192;
events {
   worker_connections  1024;
   use epoll;
   multi_accept off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 55;
recursive_error_pages    on;
server_name_in_redirect off;
server_tokens           off;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 8k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers   4 32k;
postpone_output  1460;
proxy_buffer_size          32k;
proxy_buffers              4 32k;
proxy_busy_buffers_size    64k;
proxy_temp_file_write_size 64k;
fastcgi_connect_timeout 120;
fastcgi_send_timeout 120;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort     off;

Where am i going wrong with the config, I have tried various settings but the issue still persists.

These are the errors i keep getting

2011/11/13 18:20:33 [error] 21583#0: *311683 upstream timed out (110: Connection timed   out) while reading response header from upstream, client: IP, server:, request: "GET url HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.socket:", host: "", referrer: "url"
share|improve this question

"Upstream timed out" says to you that backend (in your case it is php-fpm) don't send response in time. So if you increase your nginx timeout - look at php-fpm. Maybe it downs with core? Or creates a huge query to the DB?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.