fix: 修复 nginx 代理地址,解决页面空白问题
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Docker 网桥地址从 172.17 变为 172.18,导致 API 代理失败
This commit is contained in:
@@ -11,14 +11,19 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# API 代理到后端
|
# API 代理到后端
|
||||||
|
# 使用宿主机网关地址(Docker 默认网桥)
|
||||||
|
# 如果 172.18.0.1 不可用,可能需要调整为实际的 Docker 网桥地址
|
||||||
|
set $backend_host 172.18.0.1;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://172.17.0.1:8001/api/;
|
proxy_pass http://$backend_host:8001/api/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_read_timeout 120s;
|
proxy_read_timeout 120s;
|
||||||
|
proxy_connect_timeout 10s;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 静态资源缓存
|
# 静态资源缓存
|
||||||
|
|||||||
Reference in New Issue
Block a user