1、第三方模块下载网址
###nginx官方第三方代码库
https://www.nginx.com/resources/wiki/start/
###gitee
https://gitee.com/mirrors/nginx_upstream_check_module/repository/archive/master.zip
2、检查第三方库
检查是否有补丁需要更新,如果源码包中有.patch结尾的文件,需要打补丁更新,举例如下:
wget -c https://gitee.com/mirrors/nginx_upstream_check_module/repository/archive/master.zip
unzip master.zip
ll
结果如下
[yiifung@localhost mod]$ ll
total 180
-rw-rw-r--. 1 yiifung yiifung 177080 May 22 06:33 master.zip
drwxrwxr-x. 6 yiifung yiifung 4096 Nov 5 2022 nginx_upstream_check_module-master
[yiifung@localhost mod]$ cd nginx_upstream_check_module-master/
[yiifung@localhost nginx_upstream_check_module-master]$ ll
total 280
-rw-rw-r--. 1 yiifung yiifung 0 Nov 5 2022 CHANGES
-rw-rw-r--. 1 yiifung yiifung 7921 Nov 5 2022 check_1.11.1+.patch
-rw-rw-r--. 1 yiifung yiifung 8330 Nov 5 2022 check_1.11.5+.patch
-rw-rw-r--. 1 yiifung yiifung 8060 Nov 5 2022 check_1.12.1+.patch
-rw-rw-r--. 1 yiifung yiifung 8054 Nov 5 2022 check_1.14.0+.patch
-rw-rw-r--. 1 yiifung yiifung 8409 Nov 5 2022 check_1.16.1+.patch
-rw-rw-r--. 1 yiifung yiifung 8419 Nov 5 2022 check_1.20.1+.patch
-rw-rw-r--. 1 yiifung yiifung 5483 Nov 5 2022 check_1.2.1.patch
-rw-rw-r--. 1 yiifung yiifung 7130 Nov 5 2022 check_1.2.2+.patch
-rw-rw-r--. 1 yiifung yiifung 7094 Nov 5 2022 check_1.2.6+.patch
-rw-rw-r--. 1 yiifung yiifung 6791 Nov 5 2022 check_1.5.12+.patch
-rw-rw-r--. 1 yiifung yiifung 8295 Nov 5 2022 check_1.7.2+.patch
-rw-rw-r--. 1 yiifung yiifung 8346 Nov 5 2022 check_1.7.5+.patch
-rw-rw-r--. 1 yiifung yiifung 8509 Nov 5 2022 check_1.9.2+.patch
-rw-rw-r--. 1 yiifung yiifung 6943 Nov 5 2022 check.patch
-rw-rw-r--. 1 yiifung yiifung 769 Nov 5 2022 config
drwxrwxr-x. 2 yiifung yiifung 43 Nov 5 2022 doc
-rw-rw-r--. 1 yiifung yiifung 1709 Nov 5 2022 nginx-sticky-module.patch
drwxrwxr-x. 2 yiifung yiifung 29 Nov 5 2022 nginx-tests
-rw-rw-r--. 1 yiifung yiifung 112085 Nov 5 2022 ngx_http_upstream_check_module.c
-rw-rw-r--. 1 yiifung yiifung 529 Nov 5 2022 ngx_http_upstream_check_module.h
-rw-rw-r--. 1 yiifung yiifung 2848 Nov 5 2022 ngx_http_upstream_jvm_route_module.patch
-rw-rw-r--. 1 yiifung yiifung 11509 Nov 5 2022 README
drwxrwxr-x. 6 yiifung yiifung 79 Nov 5 2022 test
-rw-rw-r--. 1 yiifung yiifung 3342 Nov 5 2022 upstream_fair.patch
drwxrwxr-x. 2 yiifung yiifung 81 Nov 5 2022 util
[yiifung@localhost nginx_upstream_check_module-master]$
3、打补丁(PATCH)
patch -p1<$HOME/nginx-1.22.1/mod/nginx_upstream_check_module-master/check_1.20.1+.patch
4、构建(BUILD)
cd $HOME/nginx-1.22.1
./configure --prefix=$HOME/nginx \
--sbin-path=$HOME/nginx/sbin/nginx \
--user=yiifung \
--group=yiifung \
--with-stream \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-pcre=$HOME/pcre2-10.39 \
--add-module=$HOME/nginx-1.22.1/mod/nginx_upstream_check_module-master/
MAKE
make && make install
检查
cd $HOME/nginx/sbin/
./nginx -V
输出如下
[yiifung@localhost sbin]$ ./nginx -V
nginx version: nginx/1.22.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/home/yiifung/nginx --sbin-path=/home/yiifung/nginx/sbin/nginx --user=yiifung --group=yiifung --with-stream --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-pcre=/home/yiifung/pcre2-10.39 --add-module=/home/yiifung/nginx-1.22.1/mod/nginx_upstream_check_module-master/
[yiifung@localhost sbin]$