在使用TCP / UDPstream代理模块的NGINX反向代理之后使用OpenVPN

我已经使用NGINX作为我的主域的反向代理了一年多了。 该代理驻留在AWS EC2实例中,并将stream量发送到我的家庭IP地址,并伪装所有丑陋的端口组合。

尽pipe我从来没有设法让我的OpenVPN服务器与NGINX一起工作。 当我尝试通过我的域名连接到BEHIND NGINX的服务器时,它超时并说:

TCP: connect to [AF_INET]777:777:777:777:8050 failed, will try again in 5 seconds: Connection timed out

其中777.777.777.777是我的反向代理的IP地址,而不是我的家庭IP地址,它是888.888.888.888 。 在我的configuration文件中,哪个NGINX应该将代理数据stream式传输到这个块所定义的:

 stream { upstream tcp_backend { server 777.777.777.777:8050; } upstream udp_backend { server 777.777.777.777:8051; } server { proxy_connect_timeout 300s; proxy_timeout 300s; listen 8050; proxy_pass tcp_backend; } server { proxy_connect_timeout 300s; proxy_timeout 300s; listen 8051 udp; proxy_pass udp_backend; } } http { server { listen 443 ssl; server_name vpn.domain.com; ssl on; location / { proxy_pass https://888.888.888.888:943/; } } } 

现在,据我所知,我已经正确configuration了NGINX。 而且,我知道我已经configuration了VPN /家庭networking端正确的一切,就好像我configurationOpenVPN服务器来使用我的家庭服务器的IP地址一样正常: http : //i.imgur.com /UycWpOO.png

[OpenVPN Server] Peer Connection Initiated with [AF_INET]888.888.888.888:8051

如果该字段从888.888.888.888更改为vpn.domain.com ,而使用NGINX反向代理,则数据不会redirect到正确的IP地址。 相反,OpenVPN尝试连接到运行NGINX的AWS EC2实例上的端口8050和8051。

我做错了什么? 这不是stream代理的预期目的吗? 期待您的回音。 谢谢您的帮助!

编辑:如果它不是立即显而易见的,我编辑我的实际IP。 这就是为什么我使用这些无效的IP。