feat: 为 Nginx 配置 Docker 内部 DNS 解析器并使用变量代理后端服务
This commit is contained in:
@@ -25,9 +25,13 @@ server {
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# 使用 Docker 内部 DNS 解析器
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
|
||||
# API 代理到后端
|
||||
location /api/ {
|
||||
proxy_pass http://backend:2612;
|
||||
set $backend_host "backend:2612";
|
||||
proxy_pass http://$backend_host;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
@@ -45,7 +49,8 @@ server {
|
||||
|
||||
# 健康检查端点
|
||||
location /health {
|
||||
proxy_pass http://backend:2612/health;
|
||||
set $backend_host "backend:2612";
|
||||
proxy_pass http://$backend_host/health;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user