zoukankan      html  css  js  c++  java
  • nginx平滑升级(1.14--1.15)

    • 查看旧版nginx编译参数
    [root@localhost yum.repos.d]# nginx -V
    nginx version: nginx/1.14.2
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
    built with OpenSSL 1.0.2k-fips  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_modu
    le --with-http_gzip_static_module
    
    [root@localhost yum.repos.d]# ps aux | grep nginx
    root      80809  0.0  0.1  47024  1912 ?        Ss   12:10   0:00 nginx: master process nginx
    nginx     80810  0.0  2.2  69760 22652 ?        S    12:10   0:00 nginx: worker process
    nginx     80811  0.0  2.2  69760 22652 ?        S    12:10   0:00 nginx: worker process
    
    • 备份旧版本

    [root@localhost yum.repos.d]# strings /usr/local/nginx/sbin/nginx.old

    • 安装新版本的nginx(不要执行make install)
    [root@localhost ~]# tar zxf nginx-1.15.9.tar.gz -C /usr/src/
    [root@localhost nginx-1.15.9]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module && make
    #和nginx -V 查看的所编译的要相同
    
    [root@localhost nginx-1.15.9]# cp objs/nginx /usr/local/nginx/sbin/nginx
    #使用新的二进制文件代替旧的
    
    [root@localhost nginx-1.15.9]# nginx -t
    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
    #查看配置文件是否正常
    
    [root@localhost nginx-1.15.9]# nginx -V
    #如一切环境正常,可以看到版本号已经修改为新的了
    
    • 发送USR2信号
    [root@localhost nginx-1.15.9]# kill -USR2 80809
    #向主进程(master)发送 USR2 信号,Nginx 会启动一个新版本的master进程和对应工作进程,和旧版一起处理请求
    
    [root@localhost nginx-1.15.9]# ps aux | grep nginx
    
    [root@localhost ~]# kill -WINCH 80809
    #向旧的 Nginx 主进程(master)发送 WINCH信号,它会逐步关闭自己的工作进程(主进程不退出),这时所有请求都会由新版 Nginx 处理
    
    [root@localhost ~]# kill -QUIT 80809
    #向旧的 Nginx 主进程(master)发送(QUIT、TERM、或者 KILL)信号,使旧的主进程退出
    
    [root@localhost nginx-1.15.9]# nginx -v
    nginx version: nginx/1.15.9
    #测试查看版本号
    

    over……

  • 相关阅读:
    20172327 2018-2019-1 《程序设计与数据结构》实验三:查找与排序
    团队作业第二周
    需求规格说明书
    广度优先遍历
    团队作业第一周
    20172327 2018-2019-1 《程序设计与数据结构》第九周学习总结
    20172327 2018-2019-1 《程序设计与数据结构》实验二:树实验报告
    20172327 2018-2019-1 《程序设计与数据结构》第八周学习总结
    20172327 2018-2019-1 《程序设计与数据结构》第七周学习总结
    20172327 2018-2019-1 《程序设计与数据结构》第六周学习总结
  • 原文地址:https://www.cnblogs.com/jojoword/p/10758430.html
Copyright © 2011-2022 走看看