FreeBSD Clean Install nginx.pid Permissions Errors

nanaya me at nanaya.pro
Sat Jul 15 10:24:36 UTC 2017



On Sat, Jul 15, 2017, at 18:56, Viaduct Lists wrote:
> 
> > On Jul 15, 2017, at 5:04 AM, nanaya <me at nanaya.pro> wrote:
> > 
> > 
> > It works if you start it from user with root privilege. Otherwise you
> > can't switch user and thus the directive is ignored.
> 
> If I deliberately start up using root, why would I need a directive that
> indicates that?  This directive seems like a reminder after the fact.  
> 

root is usually needed to bind port 80 and 443 so usually people want to
start it using root. But apart of the binding, having everything running
as root is dangerous especially for something that's public facing so
usually root is only used for stuff which requires it and then the
worker processes, the processes which actually handle requests, are run
as different user. The `user` directive is used to tell which user the
processes should be run as.

The directive defaults to `user nobody nobody` so `user root` means you
explicitly want the workers to run as root instead of nobody (assuming
it works).

> 
> In my case, all servers reporting this are working and serving as
> expected.  So the failure and permissions errors are pretty much useless
> reporting.  
> 

While it runs, without working pid file, you'll need alternative way of
maintaining the process (upgrade, config reload, log rotate, shutdown,
etc). Especially `-s` switch of `nginx` can't be used to control running
process because it doesn't have valid pidfile.


More information about the nginx mailing list