feat: 前台404页与通配路由; 积木拖拽排序(vuedraggable); nginx SPA说明

Made-with: Cursor
This commit is contained in:
whm
2026-03-19 17:11:16 +08:00
parent 88f9d42f91
commit e1fc257435
10 changed files with 196 additions and 27 deletions

View File

@@ -72,3 +72,10 @@ sudo systemctl start nginx
```
然后再按上面步骤创建证书目录、放入证书、复制 conf 并重载。
## 5. 前台动态路由与 404SPA
- **现象**:浏览器直接打开 `https://你的域名/some-page` 出现 **nginx**`404 Not Found`(页脚带 `nginx/x.x.x`),而不是网站自己的页面。
- **原因**:提供静态文件的 `server` 未把「不存在的路径」交给 `index.html`Nginx 在磁盘上找不到 `some-page` 文件就返回 404。
- **要求**:托管 **web 前台** 的站点必须使用 **`try_files $uri $uri/ /index.html;`**(见仓库 `nginx/web.conf``web/Dockerfile` 内嵌配置)。若你自建 Nginx请对照修改后再 `nginx -t` 并重载。
- **应用内 404**:在 SPA 已正确回退的前提下,未在后台发布的路径会由前端路由进入 **「页面不存在」** 页(`NotFound.vue`),与上述 nginx 404 不同。