3

I recently setup a new ubuntu machine, with wordpress, spawn-fcgi and nginx.

Every morning, I'd try to see my blog and I got a 502 error Bad Gateway error.

I tried finding some kind of log of why php-cgi died but couldn't find anything.

I run spawn-fcgi like so:

sudo /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

I just did the following test:

ran the spawn-fcgi command, then sieged it.

After around 480 connections, spawn-fcgi died and I started getting 502 errors.

Any idea why this would happen, where I could find some kind of logs?

hakre
  • 193,403
  • 52
  • 435
  • 836
Andrei Serdeliuc ॐ
  • 5,828
  • 5
  • 39
  • 66

1 Answers1

1

This might not be real fix, but setting

PHP_FCGI_MAX_REQUESTS=400

environment variable will force php to kill itself after 400 requests and being re-executed, so the problem won't appear.

hakre
  • 193,403
  • 52
  • 435
  • 836
Michal Čihař
  • 9,799
  • 6
  • 49
  • 87