zoukankan      html  css  js  c++  java
  • 平滑升级Nginx

    1.查看当前Nginx版本及configure信息

    [root@base1 sbin]# ./nginx -V 
    nginx version: nginx/1.16.0
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
    built with OpenSSL 1.0.2k-fips  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/wxqyh/component/nginx --user=nginx --group=nginx --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --add-module=/wxqyh/component/nginx-sticky-module-ng

    2.下载对应的版本(这里是nginx-1.16.1)到相关目录下,解压并进入解压后的目录

    [root@base1 ~]# cd /usr/local/
    [root@base1 nginx-1.16.1]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
    [root@base1 nginx-1.16.1]# wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
    [root@base1 nginx-1.16.1]# tar xf openssl-1.1.0e.tar.gz
    [root@base1nginx-1.16.1]# tar xf nginx-1.16.1.tar.gz
    [root@base1 nginx-1.16.1]# cd nginx-1.16.1

    3.查看nginx版本的时候,configure后面有一大串模块,这也是你第一次安装nginx时所指定的模块,升级的时候也要同时指定,也可以添加其他模块

    [root@base1 nginx-1.16.1]# ./configure --prefix=/wxqyh/component/nginx --user=nginx --group=nginx --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --add-module=/wxqyh/component/nginx-sticky-module-ng
    
    [root@base1 nginx-1.16.1]# make

    make完以后,不需要执行make install,否则会覆盖安装,nginx服务会出现各种问题

    不中断nginx web服务器的正常运行称之为平滑升级,先重命名之前的nginx二进制文件

    [root@base1 nginx-1.16.1]# mv /wxqyh/component/nginx/sbin/nginx /wxqyh/component/nginx/sbin/nginx.bak


    拷贝刚编译新生产的Nginx二进制文件到/wxqyh/component/nginx/sbin/目录

    [root@base1 nginx-1.16.1]# cp /wxqyh/component/nginx-1.16.1/objs/nginx /wxqyh/component/nginx/sbin/

    4.开始执行升级命令

    [root@base1 nginx-1.16.1]# make upgrade
    
    自动提示:
    /wxqyh/component/nginx/sbin/nginx -t
    nginx: the configuration file /wxqyh/component/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /wxqyh/component/nginx/conf/nginx.conf test is successful
    kill -USR2 `cat /wxqyh/component/nginx/logs/nginx.pid`
    sleep 1
    test -f /wxqyh/component/nginx/logs/nginx.pid.oldbin
    kill -QUIT `cat /wxqyh/componentnginx/logs/nginx.pid.oldbin`
    
    查看nginx版本信息
    [root@base1 sbin]# ./nginx -V 
    nginx version: nginx/1.16.1
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
    built with OpenSSL 1.0.2k-fips  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/wxqyh/component/nginx --user=nginx --group=nginx --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --add-module=/wxqyh/component/nginx-sticky-module-ng
     
  • 相关阅读:
    java通过dom读写xml文件
    SWT
    Eclipse RCP学习资料
    Integration Guide
    一个Linux命令,黑客帝国
    GET和POST两种基本请求方法的区别
    贫血模式-AnemicDomainModel
    Synchronized锁在Spring事务管理下,为啥还线程不安全?
    redis 集群配置、启动
    redis cluster集群
  • 原文地址:https://www.cnblogs.com/52py/p/13064303.html
Copyright © 2011-2022 走看看