初始化2
This commit is contained in:
35
web/nginx.conf
Normal file
35
web/nginx.conf
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user