From ac76faacc4ba1aecb001e5d4b5e77cca6e78354f Mon Sep 17 00:00:00 2001 From: lzh Date: Thu, 18 Dec 2025 14:37:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E5=AE=B9=E5=99=A8ip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/nginx.conf | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/web-antd/nginx.conf b/apps/web-antd/nginx.conf index 2bbb6ed56..e2df40aa5 100644 --- a/apps/web-antd/nginx.conf +++ b/apps/web-antd/nginx.conf @@ -20,14 +20,12 @@ server { # 后端服务在 Docker 容器中,使用容器名访问(都在 aiot-net 网络中) # 如果后端在宿主机上,改为:http://172.17.0.1:48080/admin-api location /admin-api { - # 后端服务地址 - # 如果后端监听 0.0.0.0,使用容器名(推荐) - # set $backend "aiot-server:48080"; + # 后端服务地址 - 直接使用后端容器的 IP + # 方案1:使用后端容器 IP(如果后端监听 0.0.0.0) + proxy_pass http://172.22.0.2:48080/admin-api; - # 如果后端只监听 127.0.0.1,通过宿主机网关访问(当前方案) - # 172.22.0.1 是 aiot-net 网络的网关,指向宿主机 - set $backend "aiot-server:48080"; - proxy_pass http://$backend/admin-api; + # 方案2:如果方案1不行,尝试通过宿主机网关(取消注释下面这行,注释掉上面那行) + # proxy_pass http://172.22.0.1:48080/admin-api; # 代理超时设置 proxy_connect_timeout 10s;