当我用命令运行我的nginx服务器时:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
我有两个主过程
root 11632 2.6 0.1 76164 1372 ? Ss 01:30 0:06 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
www 14515 3.0 24.0 319920 245060 ? S 01:35 0:00 nginx: worker process
www 14516 3.0 24.0 319920 245060 ? S 01:35 0:00 nginx: worker process
www 14517 3.0 24.0 319920 245232 ? S 01:35 0:00 nginx: worker process
www 14518 0.0 6.5 319920 66544 ? R 01:35 0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
我的nginx.conf的一部分:
user www www;
worker_processes 4;
error_log /data/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 600000;
events
{
use epoll;
worker_connections 600000;
}
当worker_processes小于4时,ps aux | grep nginx | grep -v grep
看起来很好。如果worker_process为4,则它将有两个主进程。