Files
SeeyonFileSystem/web/nginx.conf

36 lines
1.1 KiB
Nginx Configuration File
Raw Normal View History

2026-07-10 17:33:33 +08:00
server {
listen 80;
server_name localhost; # 改为你的域名或IP
# 前端静态文件
location / {
root /opt/filesystem/frontend; # dist 解压目录
index index.html;
try_files $uri $uri/ /index.html; # SPA 路由支持
}
# API 反向代理到后端
location /api/ {
proxy_pass http://127.0.0.1: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;
# 上传大文件支持
client_max_body_size 200m;
}
# 文件 CDN (本地存储时使用, 对应 config.yaml 中 cdn_path_prefix)
location /public/ {
alias /opt/filesystem/server/data/storage/; # 本地存储目录
expires 7d;
add_header Cache-Control "public, immutable";
add_header Access-Control-Allow-Origin *;
}
# gzip 压缩
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml;
gzip_min_length 1024;
}