30 lines
803 B
Plaintext
30 lines
803 B
Plaintext
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Docker 容器运行正常的检查地址,供 Jenkins 使用。
|
|
location = /healthz {
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
# 前端代码中的 API 前缀为 /api;保持原始路径转给 Gateway。
|
|
location /api/ {
|
|
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 路由刷新时仍返回 index.html。
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|