这是一个创建于 994 天前的主题,其中的信息可能已经有所发展或是发生改变。
如题,为啥 nginx.conf 里定义了 worker_processes=1 ,还是有 3 个 worker 进程?百思不得其解
root@lnxaio1:/opt/openresty/nginx/conf# grep worker_processes nginx.conf
worker_processes 1;
root@lnxaio1:/opt/openresty/nginx/conf# ps aux |grep nginx
root 13 0.0 0.0 233480 5972 ? S 18:10 0:00 nginx: master process /opt/openresty/nginx/sbin/nginx -c /opt/openresty/nginx/conf/nginx_background.conf -g daemon off;
root 14 0.0 0.1 549668 8780 ? S 18:10 0:00 nginx: master process /opt/openresty/nginx/sbin/nginx -c /opt/openresty/nginx/conf/nginx.conf -g daemon off;
root 15 0.0 0.0 141972 6296 ? S 18:10 0:00 nginx: master process /opt/openresty/nginx/sbin/nginx -c /opt/openresty/nginx/conf/nginx_console.conf -g daemon off;
nobody 60 0.0 0.0 236412 4284 ? S 18:10 0:00 nginx: worker process
root 63 0.0 0.0 145020 5020 ? S 18:10 0:00 nginx: worker process
root 65 0.1 0.2 570756 23840 ? S 18:10 0:00 nginx: worker process
root 792 0.0 0.0 14524 1008 ? S+ 18:13 0:00 grep --color=auto nginx
提前谢过
3 条回复 • 2022-01-19 18:43:20 +08:00
|
|
1
ysc3839 2022-01-19 18:19:51 +08:00
有三个 master process ,每个 master process 有一个 worker process ,不是很正常吗?
|
|
|
2
lualuer 2022-01-19 18:36:09 +08:00
ps -ef| grep nginx root 2232 1 0 17:54 ? 00:00:00 nginx: master process nginx nginx 2233 2232 0 17:54 ? 00:00:12 nginx: worker process root 2234 2232 0 17:54 ? 00:00:07 nginx: privileged agent process root 2413 2342 0 18:30 pts/3 00:00:00 grep --color=auto nginx
这样可以看到每个 worker 进程对应的 master 进程 id (比如这个 2232 )
|
|
|
3
lander 2022-01-19 18:43:20 +08:00
原来如此,多谢两位!!
|