chore(compose): web 仅保留 public 挂载,推广走 dist/API;验证仅 yh_nginx

Made-with: Cursor
This commit is contained in:
whm
2026-03-23 17:57:09 +08:00
parent 80176ea6fc
commit 7980c1922a
9 changed files with 10 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ sudo systemctl reload nginx
**/api/health 或 /admin/ 返回 404 时**:在服务器执行 `ss -tlnp | grep 443`,看 443 是宿主机 nginx 还是 docker。若是宿主机 nginx要么停用该站点配置让 compose 独占 443方式 A要么改为方式 Bcompose 用 8443宿主机反代到 8443
**验证文件热加载**如果只需要把某些根目录验证文件上线,放到项目根目录的 `verify-root/` 即可`web` 容器会把它挂载为 `/verify-root`,并直接从网站根路径提供这些 `.txt/.html/.xml` 文件。修改文件后不需要重建 `web` 镜像,只要文件保存到宿主机上就会立刻生效
**验证文件热加载**验证文件放到项目根目录的 `verify-root/` 即可compose 内 **`yh_nginx`** 挂载该目录并在 **443** 上直接 `root /verify-root` 提供(见 `nginx/yuheng.docker.conf.tpl`)。`reload` 后生效;若仅改文件,可 `docker compose restart nginx`
## 4. 新服务器首次安装 Nginx

View File

@@ -1,16 +1,9 @@
# 供 compose 中 web 容器使用:宿主机挂载 web/dist 与 verify-root仅提供静态与 SPA 回退
# 供 compose 中 web 容器使用:与 deploy/web/default.conf 同步;验证文件仅外层 yh_nginx 处理
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location ~ ^/[A-Za-z0-9._-]+\.(txt|html|xml)$ {
root /verify-root;
try_files $uri =404;
default_type text/plain;
add_header Cache-Control "no-store";
}
location ^~ /assets/ {
try_files $uri =404;
access_log off;