Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run nginx master process with different user

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?

like image 471
Pravin Mishra Avatar asked Aug 27 '13 13:08

Pravin Mishra


1 Answers

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.

like image 114
lmars Avatar answered Sep 25 '22 09:09

lmars