can I config my nginx to run some shell command/script if encounter 5xx error?
My spawn-fcgi crashes often, I have a cronjob restart it periodically, but I think the best solution would be if nginx fail to reach spawn-fcgi then restart it via command.
Best Answer
You could run monit doing like this in the config:
the test.php is just a php file that does echo 'OK'
Of course I supose you already have a spawn-fcgi init script and a PID file.