Nginx(2) 启动,停止,信号控制

47 篇文章 0 订阅
43 篇文章 0 订阅

一,启动,停止,检查配置文件和重启

启动

 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

停止

kill -QUIT  pid    温和停止

kill -TERM pid  快速停止

kill -INT pid    快速停止

强制停止

pkill -9 nginx


验证配置文件是否没错

/usr/local/nginx/sbin/nginx -t        或    /usr/local/nginx/sbin/nginx -t  -c /usr/local/nginx/conf/nginx.conf                      
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

重启

 ./nginx -s reload 或者 kill -HUP pid


二,信号控制

PUB 重启

QUIT 温和关闭

INT 温和关闭

TERM 强制关闭

USR1 切日志

USR2 平滑升级

WINCH 关闭共总进程

查看进程

[root@dn3 nginx-1.10.1]# ps -ef|grep nginx
root      7110     1  0 11:12 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody    7111  7110  0 11:12 ?        00:00:00 nginx: worker process                                          
root      7116 28925  0 11:12 pts/0    00:00:00 grep nginx

可以看到 7110是主进程,7111是工作进程

[root@dn3 nginx-1.10.1]# ps -ef|grep nginx
root      7110     1  0 11:12 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody    7111  7110  0 11:12 ?        00:00:00 nginx: worker process                                          
root      9437 28925  0 11:39 pts/0    00:00:00 grep nginx
[root@dn3 nginx-1.10.1]# kill -WINCH 7110
[root@dn3 nginx-1.10.1]# ps -ef|grep nginx
root      7110     1  0 11:12 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
root      9439 28925  0 11:39 pts/0    00:00:00 grep nginx


平滑升级:

旧的请求依然处理,新的请求不再处理。

查看版本

[root@dn3 nginx-1.10.1]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.10.1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值