PHP FastCGI hangs

Just as a self reminder, this blog post explains why php-cgi might hang/stop silently when your load increases, and how to fix it, where it explains (in short) that fast-cgi should have the parameter PHP_FCGI_MAX_REQUESTS should equal 1000 or more (this can be done in /etc/default/php-fastcgi on my Ubuntu server).

 

Also worth a look is this page which has nothing to do with fast-cgi but describes how to increase the timeout in nginx when there is a proxy: http://blogs.agilefaqs.com/2011/07/21/upstream-connection-timed-out-error-in-nginx/ (that is if you get the timed-out connection error and do not find the setting above in the first place). In short:

server {
    listen       80;
    server_name  my.website.com;
    server_name_in_redirect off;
    port_in_redirect        off;

    location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Real-Host  $host;
        proxy_read_timeout 120;
        ...
    }
    ...
}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: