nginx平滑升级

要求:升级nginx版本到1.21.6

1.查看nginx和OpenSSL版本,记录原安装编译的模块:

[root@host sbin]# ./nginx -V
nginx version: nginx/1.18.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=--prefix=/data/service/nginx --with-http_ssl_module --with-stream

2.备份原 nginx 二进制文件,切换到nginx所在目录进行备份,备份的过程系统不受影响,

防止误操作建议备份整个nginx安装文件夹

cp -r /data/service/nginx/sbin/nginx  /data/service/nginx/sbin/nginx_$(date +%F)
cp -r /data/service/nginx /data/service/nginx_$(date +%F)

3.升级,此时不要执行 make install,要不然就会覆盖原来的版本产生诸多问题。

wget http://nginx.org/download/nginx-1.21.6.tar.gz
tar -xvf nginx-1.21.6.tar.gz
cd nginx-1.21.6
 ./configure  --prefix=/data/service/nginx --with-http_ssl_module --with-stream
make

4.复制nginx-1.21.6下的nginx到原来的nginx目录下,注意nginx-1.21.6中nginx在objs目录下而不是在sbin下面

[root@host nginx-1.21.6]# cd objs/
[root@host objs]# cp nginx /data/service/nginx/sbin/

测试是否替换成功

[root@host sbin]# /data/service/nginx/sbin/nginx -t
nginx: the configuration file /data/service/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@host sbin]# /data/service/nginx/sbin/nginx -V
nginx version: nginx/1.21.6
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

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

均衡教派.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值