fix(build): vite部署问题,部署后有缓存取到旧的chunk文件

This commit is contained in:
sophie committed 2026-08-28 11:34:37 +08:00
1 parent 09deada712
commit 57652ae581
7 files changed
+62 -108

No files matched your search

-60
View File
@@ -1,60 +0,0 @@
# hxops_nginx.conf
# 放置于 /etc/nginx/conf.d/hxops.conf
server {
listen 80;
server_name 192.168.100.230; # 或域名
# 1. 前端静态资源 (动静分离)
location / {
root /opt/hxops/frontend/dist;
index index.html;
try_files $uri $uri/ /index.html;
# 静态资源缓存策略
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
}
# 2. 后端 API 反向代理
location /api/ {
# 转发到 Gunicorn (Gevent)
proxy_pass http://127.0.0.1:5000;
# 请求体上限(主要约束上传;库存 ZIP 下载靠下方超时)
# 按业务估算:几十个大 Excel 打包约 100–300MB,预留 200m;若单批更大可改 500m
client_max_body_size 200m;
# 大文件响应超时(库存 ZIP 下载关键项)
proxy_send_timeout 300s;
send_timeout 300s;
# 关键配置:关闭缓冲以支持 SSE 流式输出
proxy_buffering off;
proxy_cache off;
# 传递客户端真实 IP
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;
# 长连接配置
proxy_http_version 1.1;
proxy_set_header Connection "";
# 超时设置 (应对长对话)
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
}
# 开启 Gzip 压缩
gzip on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
}
-34
View File
@@ -1,34 +0,0 @@
; hxops_supervisord.conf
; 放置于 /etc/supervisor/conf.d/hxops.conf
[program:hxops-backend]
; 启动命令:使用 Gunicorn 启动 Flask 应用
command=/opt/hxops/backend/venv/bin/gunicorn -c /opt/hxops/backend/deploy/gunicorn_config.py "app:create_app('production')"
; 工作目录
directory=/opt/hxops/backend
; 启动用户
user=root
; 自动启动
autostart=true
autorestart=true
; 启动重试次数
startretries=3
; 停止信号
stopsignal=QUIT
; 日志配置
stdout_logfile=/var/log/hxops/backend.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
stderr_logfile=/var/log/hxops/backend_err.log
stderr_logfile_maxbytes=50MB
stderr_logfile_backups=10
; 环境变量
environment=FLASK_APP=run.py,FLASK_ENV=production,DATABASE_URL="postgresql://hxops:password@localhost/hxops_prod"