
1 hxsf 2016-10-11 13:38:55 +08:00 ... 确保两个能连通就行 谁说一定要在同一子网内的 |
2 walkman660 2016-10-11 14:39:09 +08:00 2 台服务器不通的话,怎么写都没用 2 台服务器通的话,官方文档说怎么写就怎么写 |
3 Ellison 2016-10-11 14:53:06 +08:00 这应该去找你们网管 |
4 ifaii 2016-10-11 14:53:40 +08:00 via iPhone 有正确的路由 目标可达就可以了,跟在哪个子网没有关系 |
5 youyoumarco 2016-10-11 15:20:03 +08:00 网路通就可以了 |
6 yanest OP @xsf @walkman660 @Ellison @ifaii @youyoumarco 大哥们,网络当然通,我没说过不通吧,真实醉了。 server { listen 80; server_name brandon.yunmt.net; proxy_redirect off; location / { proxy_http_version 1.1; proxy_pass http://192.168.10.72:8099; proxy_buffering off; client_max_body_size 0; proxy_connect_timeout 3600s; proxy_read_timeout 3600s; proxy_send_timeout 3600s; send_timeout 3600s; } } |
7 yanest OP 现在访问 brandon.yunmt.net ,浏览器返回的是内网地址 |
8 surfire91 2016-10-11 15:40:33 +08:00 楼主说会出错,倒是说一下出了什么错呗 |
9 Ellison 2016-10-11 15:44:04 +08:00 @yanest 又不贴配置,又不贴日志,谁知道你是什么错误? 问题出在 proxy_redirect off 文档说的很清楚 http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect |
10 toposort 2016-10-11 15:47:00 +08:00 @yanest 你现在的错误是访问后打开的是一个内网地址么? $curl "brandon.yunmt.net" -I HTTP/1.1 302 Found Server: nginx/1.6.2 Date: Tue, 11 Oct 2016 07:45:33 GMT Content-Type: text/html;charset= Content-Length: 0 Connection: keep-alive Location: http://192.168.10.72:8099/seeyon/index.jsp 所以你的错误跟 proxy_pass 怎么写没关系啊,看下你的后端逻辑 |
11 bwangel 2016-10-11 15:47:51 +08:00 请问你的返回内网地址是什么意思,我用 docker 试了一下,完全可以啊: ``` server { listen 80; server_name zvv2x; proxy_redirect off; location / { proxy_http_version 1.1; proxy_pass http://172.17.0.1:8000; proxy_buffering off; client_max_body_size 0; proxy_connect_timeout 3600s; proxy_read_timeout 3600s; proxy_send_timeout 3600s; send_timeout 3600s; } } ``` 其中那个 zvv2x 是我的主机名,相当于 localhost , 172.17.0.1 是 docker 容器地址。 响应头是这样的: HTTP/1.1 200 OK Server: nginx/1.10.1 Date: Tue, 11 Oct 2016 07:45:31 GMT Content-Type: text/html; charset=ANSI_X3.4-1968 Transfer-Encoding: chunked Connection: keep-alive Content-Encoding: gzip |