nginx 操作,启动、停止、重启

43 篇文章 0 订阅
2 篇文章 0 订阅

查看nginx进程看看有没有启动,并可以查看进程ID

[root@tc3 nginxcs]# 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@tc3 nginxcs]# 
 
停止nginx,其实就是杀掉进程,但是要注意不能用kill -9 进程id,因为nginx启动时有子进程,所以要用下面方式杀死
[root@tc3 nginxcs]# 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@tc3 nginxcs]# kill 20544
[root@tc3 nginxcs]# 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@tc3 nginxcs]# 

启动nginx
[root@tc3 nginxcs]# 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@tc3 nginxcs]# sbin/nginx 
[root@tc3 nginxcs]# 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
[root@tc3 nginxcs]# 
 







 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值