[fix]:[FL-196][nginx 动态 DNS 解析 + 部署流程中重启 nginx,防止容器重启后 502]

This commit is contained in:
chengkai3
2026-06-27 18:17:00 +08:00
parent 4cbd7262ae
commit fdbf8839c5
2 changed files with 28 additions and 3 deletions
+10 -3
View File
@@ -4,8 +4,13 @@ server {
client_max_body_size 200m;
# Docker internal DNS resolver — forces nginx to re-resolve service names
# at runtime instead of caching IPs at startup (fixes 502 after container restart)
resolver 127.0.0.11 valid=10s;
location /api/v1/ws {
proxy_pass http://api:8000;
set $backend_api "http://api:8000";
proxy_pass $backend_api;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -18,7 +23,8 @@ server {
}
location /api/ {
proxy_pass http://api:8000;
set $backend_api "http://api:8000";
proxy_pass $backend_api;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -29,7 +35,8 @@ server {
}
location / {
proxy_pass http://web:3000;
set $backend_web "http://web:3000";
proxy_pass $backend_web;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;