1

I compiled Nginx from sources.

In the configuration file, I set up Nginx to be ran as nobody user.

However, the output of the ps aux is as following:

root      1691  0.0  0.0  27872   948 ?        Ss   11:28   0:00 nginx: master process /usr/bin/nginx -c /etc/nginx/nginx.conf
nobody    1692  0.0  0.0  28284  1852 ?        S    11:28   0:00 nginx: worker process

As you can see, master process is being ran as root user.

Is there everything ok with the configuration?

Cheers, Stojko

1 Answer 1

4

Yes, it's fine. That's how it's supposed to work: the master process does the bind to the privileged port 80. The worker processes are spawned by the master the handle actual HTTP requests, and then drop privileges (to user "nobody" in your case). Web documents (and directories) will need to be accessible by user "nobody".

4
  • Thanks. This is exactly as I thought, just needed advanced user confirmation :) Thanks for your input.
    – Stojko
    Apr 22, 2012 at 12:20
  • Just to note, Apache works the same way (a master process running as root that binds to port 80, and non-root worker processes that serve the actual HTTP requests): serverfault.com/questions/355223/…
    – cjc
    Apr 22, 2012 at 12:25
  • All ports under 1024 requires root privileges, am I right? I've marked your answer as correct.
    – Stojko
    Apr 22, 2012 at 12:29
  • Yes, ports under 1024 require root privs to bind to them.
    – cjc
    Apr 22, 2012 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .