FreeBSD Clean Install nginx.pid Permissions Errors

Francis Daly francis at daoine.org
Fri Jul 14 13:29:56 UTC 2017


On Thu, Jul 13, 2017 at 06:58:02PM -0400, Viaduct Lists wrote:

Hi there,

> But sudo nginx -t gets rid of the error on nginx.pid
> 
> That whole user/group issue on the user directive in nginx.conf is confusing as it ignores any attempt at using user root;.  

In unix land, usually, if a process starts running as root, then it is
able to "switch" to run as another user. If a process starts running as
non-root, it is not able to switch to run as another user.

And (usually) only root is able to bind() to port 80.

(Exceptions exist, but this is probably good enough for now.)

So -- if you start the nginx process as root (either by running it as
root, or by running it under "sudo"), then nginx can listen on port 80
and can switch to whatever user/group is in the config file after it is
listening on port 80.

If you start the nginx process as not-root, then it will probably fail
to listen on port 80, and fail to open any root-only files, and fail to
switch to whatever user/group is in the config file.

That seems to be what is happening here, based on the error logs shown.

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list