Unable to run proxy_bind on nginx protecting minecraft server

nginx 透明代理 · 小鸟笔记·李佶澳·影响一万人

nginx $remote_addr 详解_weixin_33834075的博客-CSDN博客

使用nginx的proxy_bind选项配置透明的反向代理

https://pengpengxp.github.io/archive/before-2018-11-10/2017-06-27-%E4%BD%BF%E7%94%A8nginx%E7%9A%84proxy_bind%E9%80%89%E9%A1%B9%E9%85%8D%E7%BD%AE%E9%80%8F%E6%98%8E%E7%9A%84%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86.html

IP Transparency and Direct Server Return with NGINX Plus

方法一:IP透明

IP 透明的目的是隐藏反向代理的存在,以便源服务器观察 IP 数据包来自客户端的 IP 地址。IP 透明可用于基于 TCP 和基于 UDP 的协议。

NGINX透明TCP代理 | 码农俱乐部 - Golang中国 - Go语言中文社区

Nginx TCP 多证书透明代理及 Linux/F-Stack(FreeBSD) 路由相关设置 – 我们的小屋 | happylife – Django

stream {       
    upstream up_server {
        server 192.168.1.3:8081;
    }
    
    # 通过 map 配置不同域名(SNI)使用不同的证书文件
    # 证书为泛解析证书, 匹配泛解析域名
    # 会降低性能
    map $ssl_server_name $targetCert {
        ~*domain1.com$ /usr/local/cert/domain1.crt;
        ~*domain2.com$ /usr/local/cert/domain2.crt;
        ~*domain2.com$ /usr/local/cert/domain3.crt;
        default /usr/local/cert/domain1.crt;
    }
    
    map $ssl_server_name $targetCertKey {
        ~*domain1.com$ /usr/local/cert/domain1.key;
        ~*domain2.com$ /usr/local/cert/domain2.key;
        ~*domain2.com$ /usr/local/cert/domain3.key;
        default /usr/local/cert/domain1.key;
    }
    
    server {
        listen 8080 ssl reuseport;
    
        ssl_certificate $targetCert;
        ssl_certificate_key $targetCertKey;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_session_tickets off;
​
        proxy_pass up_server;
        proxy_bind $remote_addr transparent; # 透明代理
    }
}

https://pengpengxp.github.io/archive/before-2018-11-10/2017-06-27-%E4%BD%BF%E7%94%A8nginx%E7%9A%84proxy_bind%E9%80%89%E9%A1%B9%E9%85%8D%E7%BD%AE%E9%80%8F%E6%98%8E%E7%9A%84%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86.html

Nginx学习笔记(五):反向代理 | 郑州搞Linux变身IT民工

proxy_bind

语法: proxy_bind address [transparent] | off;
默认值: —
上下文: http, server, location

指定将请求发往后端服务器时使用的地址。

transparent选项可以伪造IP(要求Nginx的worker进程使用root用户),比如如下配置:
proxy_bind $remote_addr transparent;

后端服务器会接受到来自客户端IP的请求,而响应如果不经过Nginx服务器的话则会报错(因为客户端压根没有请求后端服务器却莫名收到报文),经过Nginx是否需要nat支持没有测试,感觉是不用的。

nginx 透明代理 · 小鸟笔记·李佶澳·影响一万人

NGINX 透明 TCP 代理 - IT工具网

IP Transparency and Direct Server Return with NGINX Plus

NGINX transparent TCP proxy - Stack Overflow


如何使用nginx搭建http透明代理

nginx的tcp透明代理设置 - 简书


 

如何使用nginx搭建http透明代理

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐