Welcome! Log In Create A New Profile

Advanced

Re: FreeBSD Clean Install nginx.pid Permissions Errors

nanaya
July 15, 2017 12:10PM
Hi,

On Sun, Jul 16, 2017, at 00:45, Viaduct Lists wrote:
>
> My point was that you can start the service as root, or set the user to
> root in nginx.conf. It’s confusing. Two ways. If I’m deliberately
> starting the service as root, why would I need to set the config file to
> indicate so?
>
> Second, setting the nginx.conf directive to user root, whilst using the
> default www user as startup, only coughs up an error indicating the
> directive was ignored.
>
> A lot of this makes little sense.
>

Only root can create process of different user id so the directive only
works for root.

It doesn't work for non-root users. nginx will ignore it if it exists
because it will not work. It's operating system level security, not
nginx. You don't want non-root user to be able to create process under
different user id, do you?

The reason the option exist is, in many operating systems, only root
user can bind to port <1024 (including port 80 and 443 used for
http/https) so nginx must be started by root to be able to listen to
those ports.

But as previously mentioned, doing everything else as root is considered
security risk so nginx provides `user` directive to limit codes run by
root and thus reduces security risk.

1. root starts nginx
2. nginx parses config, creates master process, binds to port 80, etc as
root
3. nginx creates worker processes under different user id according to
user directive

#3 is only possible if nginx is run as root. Otherwise nginx will just
create the processes as the same user running the master process.

>
> So the only way around this as I see it is to start up as root, because
> I’ve tried absolutely everything, and nothing is getting rid of this
> nginx.pid permissions error.
>
> OK then.
>

You can either chown the nginx.pid to your user, make it writable by
your user (chgrp + chown) or point it to other directory your user own
(there is `pid` directive [1] to set it).

[1] https://nginx.org/r/pid
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 13, 2017 09:38AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Francis Daly July 13, 2017 06:48PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 13, 2017 07:00PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Francis Daly July 14, 2017 09:30AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 14, 2017 10:42AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Francis Daly July 14, 2017 11:00PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 15, 2017 04:48AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

nanaya July 15, 2017 05:06AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 15, 2017 05:58AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

nanaya July 15, 2017 06:26AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 15, 2017 11:46AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

nanaya July 15, 2017 12:10PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

gariac July 13, 2017 09:32PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 14, 2017 10:40AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Jim Ohlstein July 14, 2017 11:00AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Alberto Castillo July 14, 2017 11:06AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

gariac July 14, 2017 11:52AM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Alberto Castillo July 14, 2017 12:50PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

gariac July 14, 2017 04:24PM

Re: FreeBSD Clean Install nginx.pid Permissions Errors

Viaduct Lists July 14, 2017 01:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 260
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready