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
     
  • 相关阅读:
    自定义View的ToolBar布局报错Error:(2) No resource identifier found for attribute 'context' in package 'c
    在学git之主分支 branch
    获取发布版SHA1
    关于开启线程与UI的操作
    播放音频和视频(VideoView控件)
    通知栏Notification的应用
    Android 真机调式 Installation failed with message 远程主机强迫关闭了一个现有的连接。. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing. WA
    运行程序申请危险权限
    mysql乐观锁总结和实践
    Nginx配置文件nginx.conf中文详解
  • 原文地址:https://www.cnblogs.com/52py/p/13064303.html
Copyright © 2011-2022 走看看