6

Just installing Nginx on a fresh ubuntu server 12.04.

ps -e | grep nginx at first returned nothing so i ran nginxwhich appeared to get things started.

Running ps -e | grep nginx now returns a number of identical processes?

 1793 ?        00:00:00 nginx
 1794 ?        00:00:00 nginx
 1795 ?        00:00:00 nginx
 1796 ?        00:00:00 nginx
 1797 ?        00:00:00 nginx

Everything appears to be running, however I'm interested to know why there are multiples, what they're doing and what would happen to my server if I were to kill just one of them?

1 Answer 1

12

This is the number of your worker processes of nginx. The default configuration has 4 worker processes. They are here that the web server can handle multiple connections very fast. One of them is the master process see the output of ps fax | grep nginx:

 user@host:~# ps fax | grep nginx
 6885 ?        Ss     0:00 nginx: master process /usr/sbin/nginx
 6886 ?        S      0:00  \_ nginx: worker process
 6887 ?        S      0:00  \_ nginx: worker process
 6888 ?        S      0:00  \_ nginx: worker process
 6889 ?        S      0:00  \_ nginx: worker process

You see there is a master process and 4 child processes (workers).

Ot determine how many worker processes are configured type:

user@host:~# grep worker_processes /etc/nginx/nginx.conf
worker_processes 4;
1
  • Ah of course! I set it up with 4 workers! Duh. Thanks for the explanation!
    – Huw
    Jan 3, 2014 at 19:52

You must log in to answer this question.

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