How to run nginx master process with different user
Asked Answered
M

1

5

A/c to http://wiki.nginx.org/CoreModule#user

master process used to run with root user, is it possible to run nginx mater process with different user?

Motherinlaw answered 27/8, 2013 at 13:2 Comment(1)
Why do you want to do this? Using the user directive will change the uid anyway.Oldwife
C
10

It is possible to run the nginx master process with a different user by just running the init script as non root (i.e. /etc/init.d/nginx start).

If this is really what you want to do, you will need to ensure the log and pid directories (usually /var/log/nginx & /var/run/nginx.pid) are writable for that user, and all your listen calls are for ports greater than 1024 (because binding to ports <=1024 requires root privileges).

In most situations however, you run the nginx master process as root and specify the user directive so that nginx workers processes run as that user.

Cosma answered 27/8, 2013 at 13:47 Comment(1)
Could you be more precise on specify the user directive so that nginx workers processes run as that user.? Can you set user in each .conf which are located in separate folder fof the virtual hosts, on per sub domain? My intention is to run the proxied servers for my sub domains under unique user accounts.Khufu

© 2022 - 2024 — McMap. All rights reserved.