I was trying to setup nginx to run with one of my rails apps, when having a look at output for
ps -e | grep nginx , I realised nginx worker processes run with user nobody.
Is there a reason why they are not running as www-data ?
Yes. You most likely haven't specified the user in your nginx config.
User Directive: http://nginx.org/en/docs/ngx_core_module.html#user
How to run nginx as a particular user?
You can specify the user/group that nginx runs as, in the nginx config.
This is an example of what an nginx config might look like (notice the user directive):
Simply update your config and then reload or restart nginx and you should be good to go.
Of course you should choose the user that works best for your system, in Debian/Ubuntu there's a www-data by default, so that's a sensible choice.
The master process is run as root, then nginx will
By default it's
You can edit nginx.conf and