咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
查看nginx进程看看有没有启动,并可以查看进程ID
[root@ uu]# ps -ef|grep nginx
root 20538 1 0 13:51 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 20539 20538 0 13:51 ? 00:00:00 nginx: worker process
root 20540 20538 0 13:51 ? 00:00:00 nginx: worker process
root 24132 1 0 15:03 ? 00:00:00 nginx: master process sbin/nginx
nobody 24133 24132 0 15:03 ? 00:00:00 nginx: worker process
root 24552 20113 0 15:12 pts/2 00:00:00 grep nginx
[root@ uu]#
停止nginx,其实就是杀掉进程,但是要注意不能用kill -9 进程id,因为nginx启动时有子进程,所以要用下面方式杀死
[root@ uu]# ps -ef|grep nginx
root 20538 1 0 13:51 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 20539 20538 0 13:51 ? 00:00:00 nginx: worker process
root 20540 20538 0 13:51 ? 00:00:00 nginx: worker process
root 20544 1 0 13:51 ? 00:00:00 nginx: master process /opt/nginxcs/sbin/nginx
nobody 24052 20544 0 15:02 ? 00:00:00 nginx: worker process
root 24066 20113 0 15:02 pts/2 00:00:00 grep nginx
[root@ uu ]# kill 20544
[root@ uu]# ps -ef|grep nginx
root 20538 1 0 13:51 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 20539 20538 0 13:51 ? 00:00:00 nginx: worker process
root 20540 20538 0 13:51 ? 00:00:00 nginx: worker process
root 24104 20113 0 15:03 pts/2 00:00:00 grep nginx
启动nginx
[root@ uu]# ps -ef|grep nginx
root 20538 1 0 13:51 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 20539 20538 0 13:51 ? 00:00:00 nginx: worker process
root 20540 20538 0 13:51 ? 00:00:00 nginx: worker process
root 24104 20113 0 15:03 pts/2 00:00:00 grep nginx
[root@ uu]# sbin/nginx
[root@ uu]# ps -ef|grep nginx
root 20538 1 0 13:51 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 20539 20538 0 13:51 ? 00:00:00 nginx: worker process
root 20540 20538 0 13:51 ? 00:00:00 nginx: worker process
root 24132 1 0 15:03 ? 00:00:00 nginx: master process sbin/nginx
nobody 24133 24132 0 15:03 ? 00:00:00 nginx: worker process
root 24139 20113 0 15:03 pts/2 00:00:00 grep nginx