环境:
有阿里云服务器 1 台称为 A ,腾讯云服务器 1 台称为 B
A 的公网 ip 记为:x
nginx 部署在 B ,服务跑在 A 代理配置如图,proxy_pass ip 配置为 x

问题描述:
通过 nginx 请求 A 上的接口,返回 504 超时,error 日志如下
upstream timed out (110: Operation timed out) while reading response header from upstream
- 在 B 上直接用 x:port 去访问 A 的接口能正常返回
- 使用 tailscale 组建一个网络,将 proxy_pass 中的 id 替换为 A 在 tailscale 中的 ip ,则一切正常,nginx 可以正常访问
也就是仅当 proxy_pass ip 配置为 A 的公网 ip 时,通过 nginx 访问不到服务,返回超时,tcpdump 显示 A 没有产生任何来自 B 的链接
有没有人解答下这是什么原因呢?

