nginx 正向代理编译报错ngx_http_request.h:47:0: error —— 筑梦之路

记录下这个坑,有很多文章都没解决该问题

git clone https://github.com/chobits/ngx_http_proxy_connect_module.git

tar -zxf nginx-1.22.1.tar.gz

cd nginx-1.22.1

关键步骤在此处,此处不做好,就会出现标题的错误

patch -p1 < /root/ngx_http_proxy_connect_module/patch/proxy_connect_rewrite_102101.patch

此处打补丁,需要对应nginx版本,官方文档中有表格说明,附在后面

./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads --add-module=/root/ngx_http_proxy_connect_module

make  && make install

#注册到systemd 管理

cat /usr/lib/systemd/system/nginx.service

[Unit]
Description=nginx
After=network.target remote-fs.target nss-lookup.target
 
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPost=/bin/sleep 0.1
ExecStartPre=/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

 正向代理模块github地址:GitHub - chobits/ngx_http_proxy_connect_module: A forward proxy module for CONNECT request handling

之前做过类似的,但是没有出现这个问题,也列在这里作为参考资料

解决内网环境下的钉钉告警通知——筑梦之路_内网如何使用钉钉机器人通知_筑梦之路的博客-CSDN博客 nginx无证书代理http/https协议两种解决方案——筑梦之路_nginx ssl_preread_筑梦之路的博客-CSDN博客

猜你喜欢

转载自blog.csdn.net/qq_34777982/article/details/129387984