nginx 信号管理

本内容只针对nginx 关闭操作罗列方法技巧,不废话直接写,Nginx的信号控制如下:


1. TERM, INT 强制关闭进程

   查看nginx进程ps -aux|grep nginx
   root  8646  0.0  0.0  24844   768 ?  Ss 15:14  0:00 nginx: master process /usr/local/nginx/sbin/nginx
   nobody 8647  0.0  0.1  25256  1724 ?  S  15:14  0:00 nginx: worker process
   root   8674 0.0  0.0 112660 968 pts/3  R+   15:16   0:00 grep --color=auto nginx

   kill -INT  8646 表示强制关闭进程

 2. QUIT  优雅的关闭进程,即等请求结束后再关闭

  
    查看nginx进程ps -aux|grep nginx
    root  8646  0.0  0.0  24844   768 ?  Ss 15:14  0:00 nginx: master process /usr/local/nginx/sbin/nginx
    nobody 8647  0.0  0.1  25256  1724 ?  S  15:14  0:00 nginx: worker process
    root   8674 0.0  0.0 112660 968 pts/3  R+   15:16   0:00 grep --color=auto nginx

    kill -QUIT 8646  表示等请求结束后再关闭
 

 3. HUP 改变配置文件,平滑的重读配置文件

    查看nginx进程ps -aux|grep nginx
     root  8646  0.0  0.0  24844   768 ?  Ss 15:14  0:00 nginx: master process /usr/local/nginx/sbin/nginx
     nobody 8647  0.0  0.1  25256  1724 ?  S  15:14  0:00 nginx: worker process
     root   8674 0.0  0.0 112660 968 pts/3  R+   15:16   0:00 grep --color=auto nginx

     kill -HUP 8646  软重启,重加载文件

 4. USR1 重读日志

    查看nginx进程ps -aux|grep nginx
   root  8646  0.0  0.0  24844   768 ?  Ss 15:14  0:00 nginx: master process /usr/local/nginx/sbin/nginx
   nobody 8647  0.0  0.1  25256  1724 ?  S  15:14  0:00 nginx: worker process
   root   8674 0.0  0.0 112660 968 pts/3  R+   15:16   0:00 grep --color=auto nginx


         kill -USR1 8646  重读日志  

猜你喜欢

转载自www.cnblogs.com/M87-A/p/11208265.html
今日推荐