daemon off in production
mdounin at mdounin.ru
Sat Sep 17 10:30:29 UTC 2011
On Sat, Sep 17, 2011 at 07:40:19AM +0300, Yaniv Aknin wrote:
> The documentations says I should never run nginx with the daemon off setting
> in production. I would like to do so anyway so my Python/twisted based
> process manager will have an easier time knowing if nginx terminated or not
> (I know there are other ways to do it, but this seems like the easiest; if
> I'll be forced to, I'll use another way).
> I'm aware of SIGWINCH and nginx in general and especially after version
> 1.1.1, and I don't mind taking care of guaranteeing nginx will run without a
> controlling terminal (I will fork()/setsid() before exec()ing it), run in a
> sensible current working directory, etc. I just don't want it to do the
> daemonizing double fork.
> From skimming the code, it appears to me that nothing bad should happen.
> What am I missing? Why is it so bad to run nginx in the foreground in
Documentation says "daemon" is generally used for development,
it doesn't say it shouldn't be used in production. It's safe to
run with "daemon off;" if you use some controlling process
manager. Note that you don't really need to setsid(), nginx will
take care of this even with "daemon off;".
Please don't confuse with "master_process off;". It's *unsafe* to
run with "master_process off;" and it's *only* used for
More information about the nginx