nginx_upstream_check_module模块热部署

该文章详细介绍了如何通过打补丁的方式在现有的nginx上部署nginx_upstream_check_module模块,包括下载补丁包,查看nginx版本,使用patch命令打补丁,重新编译,替换nginx执行文件,并进行配置检查和健康检查配置。
摘要由CSDN通过智能技术生成

nginx_upstream_check_module模块热部署

nginx_upstream_check_module模块以打补丁的方式部署自原有的nginx上
补丁包获取地址:

https://codechina.csdn.net/mirrors/yaoweibin/nginx_upstream_check_module

https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master

部署步骤

1、下载新模块 nginx_upstream_check_module && 解压

​ unzip nginx_upstream_check_module-master.zip

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-fDL1JGaH-1689729417328)(C:\Users\fangshuai39224\AppData\Roaming\Typora\typora-user-images\image-20211021163436775.png)]

2、查看现有nginx版本

​ ./sbin/nginx -V

nginx version: ngx-gtn/1.15.9
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) 
built with OpenSSL 1.1.1b  26 Feb 2019
TLS SNI support enabled
configure arguments: --prefix=/root/nginx-1.15.x/deploy/nginx-1.15.9-std --user=nginx --group=nginx --prefix=/application/nginx-1.6.3/ --with- http_stub_status_module --with-http_ssl_module --add-module=/home/oldboy/tools/nginx-upstream-fair-master --add-module=/home/oldboy/tools/nginx_upstream_hash-master
3、进入当前nginx 的源文件, 用 patch 方式打补丁(需要有编译原文件)
cd /home/nginx/nginx-1.15.9-std(进入编译原文件目录)
patch -p1 < ../nginx_upstream_check_module-master/check_xxx+patch(nginx版本对应的补丁包)
4、编译
1、通过./sbin/nginx -v 拿到原来编译的参数
configure arguments: --prefix=/root/nginx-1.15.x/deploy/nginx-1.15.9-std --user=nginx --group=nginx --with-pcre=/root/nginx-1.15.x/.Source-code-std/third-party/pcre-8.43 --with-zlib=/root/nginx-1.15.x/.Source-code-std/third-party/zlib-1.2.11 --with-openssl=/root/nginx-1.15.x/.Source-code-std/third-party/openssl-1.1.1b --with-openssl-opt=enable-tls1_3 --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module
2、 执行./configure +原有的参数+新增的模块
./configure --prefix=/root/nginx-1.15.x/deploy/nginx-1.15.9-std --user=nginx --group=nginx --with-pcre=/root/nginx-1.15.x/.Source-code-std/third-party/pcre-8.43 --with-zlib=/root/nginx-1.15.x/.Source-code-std/third-party/zlib-1.2.11 --with-openssl=/root/nginx-1.15.x/.Source-code-std/third-party/openssl-1.1.1b --with-openssl-opt=enable-tls1_3 --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --add-module=../nginx_upstream_check_module-master/
3、编译完成后执行make,但不要执行make install
5、 新生成的nginx执行文件 替换现有版本的nginx执行文件
1、备份原有的nginx执行文件
mv /home/nginx/nginx-1.15.9-std/sbin/nginx /home/nginx/nginx-1.15.9-std/sbin/nginx.bank
2、替换新生成的nginx执行文件
cp ./objs/nginx /home/nginx/nginx-1.15.9-std/sbin/
6、检查配置是否正常, 查看nginx现在的模块
./sbin/nginx -t
./sbin/nginx -s reload
./sbin/nginx -V

可看到nginx_upstream_check_module模块已加载。

7、配置相关健康检查配置 重启nginx
配置方法和说明请查看nginx_check方案文档
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值