2026-02-08 08:22:43 +00:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name localhost;
|
|
|
|
|
|
|
|
|
|
# 前端静态文件路径
|
2026-02-09 19:26:46 +00:00
|
|
|
location / {
|
|
|
|
|
root /usr/share/nginx/html;
|
2026-02-08 15:38:56 +00:00
|
|
|
try_files $uri $uri/ /index.html;
|
2026-02-08 08:22:43 +00:00
|
|
|
index index.html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# API 代理到后端
|
2026-02-08 15:38:56 +00:00
|
|
|
location /prod-api/ {
|
2026-02-08 08:22:43 +00:00
|
|
|
proxy_pass http://backend:8080/;
|
|
|
|
|
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;
|
|
|
|
|
proxy_connect_timeout 600;
|
|
|
|
|
proxy_read_timeout 600;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 错误页面
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
|
location = /50x.html {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
}
|
|
|
|
|
}
|