专注Java教育14年 全国咨询/投诉热线:444-1124-454
赢咖4LOGO图
始于2009,口口相传的Java黄埔军校
首页 hot资讯 实现Nginx跳转访问的代码

实现Nginx跳转访问的代码

更新时间:2021-12-17 11:45:56 来源:赢咖4 浏览859次

Nginx跳转访问的代码 

服务器 {
        听8888;
        server_name 本地主机;
        #charset koi8-r;
        #access_log 日志/host.access.log 主;
        地点 / {
            根html;
            index index.html index.htm index.jsp;
            proxy_pass http://xx.xx.xx.xx:xxxx;
            proxy_set_header 主机 $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;       
        }

在局域网中,网段是隔离的,网段1需要访问网段2网站。这时候需要在一台有内外网的中间机器上设置nginx。网络可以通过修改nginx.conf文件(在nginx下的conf文件夹中)来实现。Segment 1访问中间服务器,实现对Segment 2的跳转访问。

提交申请后,顾问老师会电话与您沟通安排学习

免费课程推荐 >>
技术文档推荐 >>