d29dce91fa
配置页增加「新手引导视频」分区(GuideVideoConfig.tsx):上传 MP4、设置 生效次数、开关启停。types.ts 补齐对应类型。nginx 配置放宽该上传接口的 client_max_body_size,否则大视频在网关就被 413 挡下、到不了后端。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: guke <guke@wonderable.ai> Co-authored-by: 左辰勇 <exinglang@gmail.com> Reviewed-on: #69 Co-authored-by: zuochenyong <zuochenyong@wonderable.ai> Co-committed-by: zuochenyong <zuochenyong@wonderable.ai>
72 lines
2.8 KiB
Plaintext
72 lines
2.8 KiB
Plaintext
# admin.shaguabijia.com — 傻瓜比价运营后台
|
|
# 前端(Next.js,pm2 :3001) + /admin/api 反代到 admin 后端(uvicorn :8771)
|
|
# 前后端同域,前端 axios 用相对路径,无需 CORS。
|
|
|
|
server {
|
|
listen 80;
|
|
server_name admin.shaguabijia.com;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name admin.shaguabijia.com;
|
|
|
|
ssl_certificate /etc/nginx/ssl/admin.shaguabijia.com.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/admin.shaguabijia.com.key;
|
|
|
|
# ⚠️ 强烈建议:IP 白名单(只放运营出口 IP)。后台能看全量用户数据 + 操作真钱。
|
|
# 取消注释并填真实 IP:
|
|
# allow 1.2.3.4;
|
|
# deny all;
|
|
|
|
client_max_body_size 10m;
|
|
|
|
# admin API → 后端 8771。X-Forwarded-For 用 $remote_addr 覆盖客户端传入值,
|
|
# 防伪造审计 IP(对齐 app/admin/deps.py get_client_ip 的注释要求)。
|
|
location /admin/api/ {
|
|
proxy_pass http://127.0.0.1:8771;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# 新手引导视频上传:视频比图片大一个量级,单独放宽到 100MB(对齐后端
|
|
# settings.GUIDE_VIDEO_MAX_BYTES)。不放宽全站上限,避免其它接口被大 body 打。
|
|
# 上传大文件耗时长,读超时同步放宽到 300s。
|
|
location = /admin/api/guide-video/video {
|
|
client_max_body_size 100m;
|
|
proxy_pass http://127.0.0.1:8771;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
proxy_request_buffering off;
|
|
}
|
|
|
|
# 用户上传媒体(上报截图 / 反馈截图 / 反馈二维码)由 App 后端(:8770)的 /media 托管。
|
|
# admin 页面要展示这些图,经此同域反代过去(免跨域 + 免 https 页面引 http 图被拦)。
|
|
# 前提:App 后端与本 admin 同机;若分机,把 127.0.0.1:8770 换成 App 后端可达地址。
|
|
# 配好此段后,前端 .env.production 的 NEXT_PUBLIC_MEDIA_BASE 留空即走同域。
|
|
location /media/ {
|
|
proxy_pass http://127.0.0.1:8770;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# 其余 → Next.js 前端
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|