runit and nginx
You can use option daemon off
:
exec /usr/sbin/nginx -c /etc/nginx/nginx.conf -g "daemon off;"
From nginx wiki:
You can use daemon off safely in production mode with runit / daemontools however you can't do a graceful upgrade. master_process off should never be used in production.
When you use runit
to control nginx
, it becomes the parent process of the nginx
master process. But if you try to do an online upgrade, the nginx
master process will fork and execute the new binary.
A new master process is created, but because old master process still exists (because it's controlled by runit
), the parent of the new master process will be the init process, because runit
can not control new master master process as it didn't start it.