Monday, May 09, 2011

nginx and daemontools

To use nginx with daemontools, the following configuration variable has to be set in your nginx.conf.

daemon off;

The following is the simple /service/nginx/run script to use with daemontools.

#!/bin/sh

exec fghack /usr/sbin/nginx

To get your php-cgi working with nginx, you'd use spawn-fcgi, which is a tool spinned-off from lighttpd.

The /service/php-cgi/run script

#!/bin/sh

PHP_FCGI_CHILDREN=2 \
PHP_FCGI_MAX_REQUESTS=1000 \
exec /usr/bin/spawn-fcgi -n -p 9999 -a 127.0.0.1 -u nginx -g nginx -- /usr/bin/php-cgi