30 lines
740 B
Plaintext
30 lines
740 B
Plaintext
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
location = /healthz {
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
# 前端统一请求 /api,保持原始路径转发给 Gateway。
|
|
location /api/ {
|
|
client_max_body_size 6m;
|
|
proxy_pass ${API_UPSTREAM};
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# 支持 Vue Router history 路由直接刷新。
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|