最新原生nginx-1.26 打最新的主动检测补丁并编译。

nginx 原生的负载均衡只是后端服务进行逐个尝试,而不是主动对后端服务进行探测,下面对最新稳定版的nginx 1.26 打上 负载均衡主动探测功能。 见之前文件 https://wenda.zuncuang.com/article/...

nginx 原生的负载均衡只是后端服务进行逐个尝试,而不是主动对后端服务进行探测,下面对最新稳定版的nginx 1.26 打上 负载均衡主动探测功能。

见之前文章  https://wenda.zuncuang.com/article/25

我是在ubuntu24.04上安装的

nginx已经从1.23上支持了openssl-3.0.X   我当前的 ubuntu 24.04 上的openssl 版本是:

openssl version

OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)


1,安装nginx的依赖包  

apt install -y  libjemalloc-dev libpcre3-dev libghc-zlib-dev lrzsz  libgflags2.2 debsums libmecab2 libssl-dev libgd-dev

2,下载nginx和nginx负载均衡主动探测的补丁程序,都通过git clone 下载到/root 目录

git clone https://github.com/nginx/nginx.git
git clone https://github.com/alexzzh/ngx_health_detect_module.git


3,应用补丁

      3.1,cd nginx

      3.2, git checkout  stable-1.26

            #如果没有合适补丁,那说明此补丁暂时不支持当前的nginx版本

      3.3, git apply ../ngx_health_detect_module/patch/nginx_healthdetect_for_nginx_1.26+.patch 

如果没有错误,说明补丁正常打完,可以通过 git status 查看。如果不合适,通过git reset --hard 恢复即可


4,编译nginx--1.26

git checkout stable-1.26

./auto/configure --user=www --group=www --prefix=/usr/local/nginx_new  --with-stream  --with-pcre --add-module=../ngx_health_detect_module --with-http_v2_module  --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module  --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-http_v3_module


5, make -j 2 ;make install


6,配置文件

       6.1 proxy.conf 文件,主要配置代理相关参数 ,需要建立缓存目录 mkdir -p /usr/local/nginx_new/{proxy_temp_dir,proxy_cache_dir}
 
     proxy.conf  放到 /usr/local/nginx_new/conf 下
    mps.szyungoo.com.conf 为此域名配置文件
    8083.conf 为代理
    nginx_new.service 为nginx启动文件


  • 发表于 2025-05-04 18:34
  • 阅读 ( 65 )

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
每天惠23
每天惠23

33 篇文章

作家榜 »

  1. shitian 662 文章
  2. 石天 437 文章
  3. 每天惠23 33 文章
  4. 小A 29 文章