Centos 6.9下nginx 1.12.1平滑升级nginx 1.14.2

1、查看当前Nginx版本

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.12.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 
built with OpenSSL 1.1.0f  25 May 2017
TLS SNI support enabled
configure arguments: --with-http_gunzip_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-openssl=/opt/software/openssl-1.1.0f
[root@localhost sbin]# 

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

2、安装nginx

下载openssl和nginx

[root@localhost local]# wget https://www.openssl.org/source/openssl-1.1.1b.tar.gz
[root@localhost local]# tar xzvf openssl-1.1.1b.tar.gz
[root@localhost local]# wget http://nginx.org/download/nginx-1.14.2.tar.gz
[root@localhost local]# tar xzvf nginx-1.14.2.tar.gz
[root@localhost local]# cd nginx-1.14.2

编译、安装

[root@localhost nginx-1.14.2]# ./configure  --with-http_gunzip_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-openssl=/usr/local/openssl-1.1.1b

[root@localhost local]#make

make完以后,不需要执行make install,否则会覆盖安装,nginx服务有问题。
先重命名原nginx二进制文件,然后拷贝新编译生成的nginx文件到安装目录

[root@localhost sbin]# mv nginx nginx-1.13.5
[root@localhost nginx-1.14.2]# cp objs/nginx /opt/nginx/sbin/

执行升级命令

[root@localhost nginx-1.14.2]# make upgrade
/opt/nginx/sbin/nginx -t
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
kill -USR2 `cat /opt/nginx/logs/nginx.pid`
sleep 1
test -f /opt/nginx/logs/nginx.pid.oldbin
kill -QUIT `cat /opt/nginx/logs/nginx.pid.oldbin`
[root@localhost nginx-1.14.2]# 

验证版本

进入安装目录,查看nginx版本

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.14.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 
built with OpenSSL 1.1.1b  26 Feb 2019
TLS SNI support enabled
configure arguments: --with-http_gunzip_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-openssl=/usr/local/openssl-1.1.1b

已经完成平滑升级。

3、补充说明

平滑升级,从1.12到1.13,从1.13到1.14,或者直接从1.12到1.14都验证可行。但是还是建议升级之前备份原nginx目录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值