前提:

内网电脑只能能够访问外网电脑的8086端口。

外网电脑能否访问外网地址。

nginx.conf配置文件示例如下:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;


    server {
        listen       8086;
        server_name  10.33.36.81;


        #charset koi8-r;


        #access_log  logs/host.access.log  main;
        location / {
        proxy_pass http://test.com/;
        proxy_set_header Host test.com;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

     }

}

效果:

内网电脑通过访问外网电脑IP+端口访问到外网地址:
http://10.33.36.81:8086

Logo

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

更多推荐