🎨 更新环境配置,添加 Dockerfile,优化代码结构
This commit is contained in:
33
web-admin/nginx.conf
Normal file
33
web-admin/nginx.conf
Normal file
@@ -0,0 +1,33 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# 文件上传大小限制 50MB
|
||||
client_max_body_size 50m;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 将 /api/ 请求反代到后端(去掉 /api 前缀,与 vite dev proxy 行为一致)
|
||||
location /api/ {
|
||||
proxy_pass http://server:8888/;
|
||||
proxy_http_version 1.1;
|
||||
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_read_timeout 35s;
|
||||
proxy_send_timeout 35s;
|
||||
proxy_connect_timeout 10s;
|
||||
}
|
||||
|
||||
# SPA fallback:所有非文件路径返回 index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 静态资源缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user