I have a manual install of nginx on Ubuntu 12.04. When I ran ./configure
I used the following options:
./configure --user=www-data --group=www-data --with-http_ssl_module --with-http_realip_module
Now the nginx worker processes run under the www-data user in the www-data group. However, I wish to change this to a different user (called nginx in my case).
Is this possible to do after running make
and make install
already?
Any help would be much appreciated.
Run as an unprivileged user First, create a new user without sudo privileges. Then you can configure nginx to run as an unprivileged system user (e.g., not the root user or a user with sudo privileges). This is done via the user directive in the /etc/nginx/nginx. conf configuration file.
One process is owned by root , the other one is owned by www-data . I didn't changed the nginx. conf yet, so the configured user is still www-data .
By default nginx uses www-data user for purpose of website and application, it is also the same user name that was used by the server of apache. Sometimes we need to change the user in our website for security reasons or we can also change the user for another purpose.
What are worker_processes in Nginx. The worker_processes are used to specify the total number of worker processes to spawn simultaneously. The number of worker_processes in Nginx is set to one by default. Executing one worker process per CPU core works perfectly, and we also recommend you configure it in this way.
As long as your new user (nginx in your case) has the proper rights, everything should work.
You have to change your user setting in nginx.conf
... user nginx; ...
and restart/reload your server. Link to docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With