• nginx升级不改变配置文件


    查看当前版本是:1.10.3

    [root@proxy nginx-1.10.3]# /usr/local/nginx/sbin/nginx -V
    nginx version: nginx/1.10.3
    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: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module

    下载新版本压缩包并解压到/opt目录下

    [root@proxy opt]# tar -xf nginx-1.12.2.tar.gz -C /opt/

    进入该目录

    [root@proxy opt]# cd nginx-1.12.2/

    [root@proxy nginx-1.12.2]# ls
    auto     CHANGES.ru  configure  html     man     src
    CHANGES  conf        contrib    LICENSE  README

    配置安装模块及信息

    [root@proxy nginx-1.12.2]# ./configure --user=nginx --group=nginx --with-http_ssl_module

    编译

    [root@proxy nginx-1.12.2]# make

    查看当前目录发现多了一个objs目录

    [root@proxy nginx-1.12.2]# ls
    auto     CHANGES.ru  configure  html     Makefile  objs    src
    CHANGES  conf        contrib    LICENSE  man       README

    将之前的版本备份

    [root@proxy nginx-1.12.2]# mv /usr/local/nginx/sbin/nginx  /usr/local/nginx/sbin/old_nginx

    将objs目录下新的nginx拷贝到/usr/local/nginx/sbin/目录下

    [root@proxy nginx-1.12.2]# cp objs/nginx /usr/local/nginx/sbin/

    查看升级后的版本为:1.12.2

    [root@proxy nginx-1.12.2]# /usr/local/nginx/sbin/nginx -V
    nginx version: nginx/1.12.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: --user=nginx --group=nginx --with-http_ssl_module

    最后,启动升级后的nginx

    [root@proxy nginx-1.12.2]# make upgrade
    /usr/local/nginx/sbin/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
    kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
    sleep 1
    test -f /usr/local/nginx/logs/nginx.pid.oldbin
    kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

    或者直接结束nginx进程重启

    [root@proxy nginx-1.12.2]# pkill nginx
    [root@proxy nginx-1.12.2]# /usr/local/nginx/sbin/nginx

    查看80端口是否启动并被nginx所用

    [root@proxy nginx-1.12.2]# netstat -ntulp |grep nginx
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4502/nginx: master

    至此,nginx升级成功!

  • 相关阅读:
    .NET版UEditor报请求后台配置项http错误,上传功能无法使用的错误解决
    [Asp.net mvc]Asp.net mvc 中使用LocalStorage
    Asp.net mvc Kendo UI Grid的使用(三)
    [Asp.net mvc]Asp.net mvc 使用Json传递数据
    Asp.net mvc Kendo UI Grid的使用(二)
    接口
    结构
    多态
    继承
    方法
  • 原文地址:https://www.cnblogs.com/guarding/p/12127690.html
Copyright © 2020-2023  润新知