nginx平滑升级及添加新功能

nginx平滑升级及添加新功能

nginx平滑升级过程

①获取老版本编译信息
②获取新版本安装包或添加功能包
③配置新版本或功能,配置是加上老版本的编译信息和新版本或功能(–add-module)
④编译,编译完后不能执行安装操作
⑤备份老版本程序,停掉老版本程序的进程,将新版本程序复制到老版本所在位置后,替换老版本

//下载nginx-1.22.0
[root@nginx ~]# wget https://nginx.org/download/nginx-1.22.0.tar.gz

//解压nginx-1.22.0
[root@nginx ~]# tar xf nginx-1.22.0.tar.gz 

//进入nginx-1.22.0解压目录
[root@nginx ~]# cd nginx-1.22.0
[root@nginx nginx-1.22.0]# ls
auto     CHANGES.ru  configure  html     man     src
CHANGES  conf        contrib    LICENSE  README

//gitee获取nginx_module_echo模块
[root@nginx ~]# yum -y install git
[root@nginx ~]# git clone https://gitee.com/wujunze/nginx_module_echo.git

//编译(只能编译,不能安装!!!)
[root@nginx nginx-1.22.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-debug --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --add-module=/root/nginx_module_echo

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

//进行平滑升级
[root@nginx ~]# pkill nignx;\cp /usr/local/nginx/sbin/nginx{,bak};\cp /root/nginx-1.22.0/objs/nginx /usr/local/nginx/sbin/nginx;systemctl start nginx

//查看nginx版本
[root@nginx ~]# nginx -v
nginx version: nginx/1.22.0

//查看新增nginx_module_echo模块
[root@nginx ~]# nginx -V
nginx version: nginx/1.22.0
built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC) 
built with OpenSSL 1.1.1k  FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-debug --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --add-module=/root/nginx_module_echo/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值