33 lines
848 B
Nginx Configuration File
33 lines
848 B
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name localhost;
|
||
|
||
# API 代理到后端服务(K8s 内部通信)
|
||
location /api {
|
||
proxy_pass http://airlabs-manage-backend:8000;
|
||
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;
|
||
}
|
||
|
||
location / {
|
||
root /usr/share/nginx/html;
|
||
index index.html index.htm;
|
||
# SPA 路由刷新 404 的关键配置
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
# 静态资源缓存
|
||
location /assets/ {
|
||
root /usr/share/nginx/html;
|
||
expires 7d;
|
||
add_header Cache-Control "public";
|
||
}
|
||
|
||
error_page 500 502 503 504 /50x.html;
|
||
location = /50x.html {
|
||
root /usr/share/nginx/html;
|
||
}
|
||
}
|