nginx代理内网服务器访问外网

2022-11-21  本文已影响0人  暴风鱼

内网机器ip : 1.1.1.1
跳板机(安装nginx) ip : 2.2.2.2
要调用的外网服务器ip : 9.9.9.9

在跳板机nginx做如下配置

    server {
            listen 9988;
            location / {
                    #  注意不要以/结束,参加 https://www.jianshu.com/p/b010c9302cd0
                    proxy_pass http://9.9.9.9:9999;
            }
    }

在内网机器1.1.1.1上 访问 http://2.2.2.2:9988 , 就能直接访问到 http://9.9.9.9:9999

上一篇 下一篇

猜你喜欢

热点阅读