Files
senmesh-zc/deployment/iw/nginx/web.conf
KodouWZF d39b3b035d feat(部署): 新增 deployment/ 内外网两套按侧部署包
按 demo/ 的写法把交付包改成「角色由目录决定」:iw/ 拷内网机、ow/ 拷外网机,
各自含镜像 tar、SQL、配置与 install.sh,install.sh 不再收 iw/ow 参数。

前端不再打进镜像,改为静态包放在 <侧>/web/ 只读挂进 nginx:1.27-alpine,
现场临时改页面直接替换文件 + restart web 即可。数据仍全部挂宿主机,
子目录命名与 deploy/offline 一致(pgdata/redis/mq/upload/logs/gate),
默认根改为包内 ./volumes,放数据盘只改 .env 的 SFILE_DATA_ROOT。

后端镜像 sfile-app:1.0.1 含传输优化那一批(实测组包 11.4×、解包 9.9×)。
出包脚本 deployment/scripts/build-package.sh 负责 jar→镜像→前端双包→sql→tar→VERSION。
2026-11-04 21:44:56 +08:00

45 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name _;
charset utf-8;
# 站点根 = 宿主机 web/ 目录(compose 里 ./web:/usr/share/nginx/html:ro)
# 临时改页面:替换 web/ 下的文件后 docker compose restart web,不用重建镜像
root /usr/share/nginx/html;
index index.html;
# 与后端 multipart 上限(500MB)保持一致,改这里要同步改 config/application.yml
client_max_body_size 500m;
client_body_timeout 300s;
# /api/xxx -> 后端 /xxx(去掉 /api 前缀,与前端构建时的 VITE_API_URL=/api 对应)
# app 是 compose 里的服务名,改了服务名这里要跟着改
location /api/ {
proxy_pass http://app:8080/;
proxy_http_version 1.1;
# 必须保留端口($http_host):后端 getRootDomain 对「无端口的 IP/localhost」会抛
# IllegalStateException,导致登录成功回调 500。改成 $host 就会复现这个坑
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 60s;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
# 大文件上传不在 nginx 侧缓冲,直接流给后端
proxy_request_buffering off;
}
# SPA:hash 路由,静态资源找不到时回落 index.html
location / {
try_files $uri $uri/ /index.html;
}
# 构建产物的文件名自带 hash,可以放心缓存;index.html 不在其中,换包后浏览器直接拿到新的
location ~* \.(js|mjs|css|woff2?|ttf|png|jpe?g|gif|svg|ico)$ {
expires 7d;
access_log off;
}
}