This commit is contained in:
tao.chen
2026-07-31 09:35:53 +08:00
parent 62c7d7465e
commit 5c61f1814e
12 changed files with 737 additions and 259 deletions
+22
View File
@@ -16,6 +16,28 @@ server {
# 指定 Docker 内置 DNS 解析器,并设置 30 秒缓存
resolver 127.0.0.11 valid=30s ipv6=off;
location / {
root /usr/share/nginx/html; # 前端静态文件存放在容器中的路径
index index.html index.htm;
# 核心:支持 SPA 路由(前端 React Router / Vue Router 刷新不报 404
try_files $uri $uri/ /index.html;
}
#(可选)针对静态文件资源加长期缓存优化
# location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|woff|woff2)$ {
# root /usr/share/nginx/html;
# expires 2h; # 前端静态缓存2小时
# add_header Cache-Control "public, no-transform";
# }
location /api/ {
proxy_pass http://backend:8000/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# =========================================================================
# 1. RustFS 对象存储服务转发 (/storage/)
# =========================================================================