nginx状态码列表(nginx1.18.0正向代理升级)

此文仅适用于nginx正向代理(https)升级参考,nginx 安装请查看官网教程,建议采用docker镜像安装,便于后面软件升级工作。

一、nginx当前信息:

版本:1.18.0

作用:搭建正向代理服务,需支持https的代理

第三方模块:ngx_http_proxy_connect_module

二、nginx 最新版本信息可通过http://nginx.org/en/download.html 可查询下载

nginx状态码列表(nginx1.18.0正向代理升级)(1)

三、ngx_http_proxy_connect_module模块可通过https://github.com/chobits/ngx_http_proxy_connect_module地址查看相关的信息及使用方法,注意与nginx版本的对应关系

nginx状态码列表(nginx1.18.0正向代理升级)(2)

四、升级操作

1、下载nginx:http://nginx.org/download/nginx-1.22.0.tar.gz,并上传到服务器指定目录

执行tar -zxvf nginx-1.22.0.tar.gz

2、下载ngx_http_proxy_connect_module:https://github.com/chobits/ngx_http_proxy_connect_module/archive/refs/heads/master.zip

nginx状态码列表(nginx1.18.0正向代理升级)(3)

注意:要按上图点击“Download ZIP”下载,上传到服务器指定目录,执行unzip ngx_http_proxy_connect_module_master.zip

3、这两个文件解压在同一目录下,cd 解压后的nginx根目录,

a、执行 patch -p1 < ../ ngx_http_proxy_connect_module_master/path/proxy_connect_rewrite_102101.patch

b、执行 nginx -V

nginx状态码列表(nginx1.18.0正向代理升级)(4)

复制configure arguments对应的参数信息,执行 ./configure --prefix=/app/nginx-1.22.0 --with-http_ssl_module --with-http_stub_status_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-pcre=../pcre-8.43 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.1j --add-module=../ngx_http_proxy_connect_module-master

标红的按实际目录修改

c、执行 make &make install 后,到安装目录将旧的nginx.conf文件复制过来,重新启动即可,如/app/nginx-1.22.0/sbin/nginx -c /app/nginx-1.22.0/conf/nginx.conf

d、ps -ef|grep nginx 即可查看进程是否启动

五、遇到的问题

1、下载ngx_http_proxy_connect_module模块必须通过上面我所说的形式下载,不然在make的时候会有 “\r ”类似异常

2、注意nginx 与ngx_http_proxy_connect_module 之间版本的对应关系,不能搞错,我用nginx 1.20.2 对应 ngx_http_proxy_connect_module 的proxy_connect_rewrite_102101.patch 在make 的时候会提示“proxy_connect undeclared(first use in this function )”错误

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页