修改大屏
This commit is contained in:
@@ -132,4 +132,32 @@ pm2 status government-backend
|
||||
|
||||
# 测试API连通性
|
||||
curl -k https://ad.ningmuyun.com/api/government/departments
|
||||
```
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 附:历史路由刷新 404 修复
|
||||
|
||||
若在访问如 `https://ad.liaoniuyun.com/government/farmer` 并刷新后出现 404,这是前端使用 `history` 路由模式时,服务器未对深链接进行回退到 `index.html` 导致。请在 Nginx 中为 `/government/` 增加路由回退:
|
||||
|
||||
```nginx
|
||||
# 优先匹配政府端前端路径,并做历史路由回退
|
||||
location ^~ /government/ {
|
||||
# 推荐使用 root 方式,目录中应包含 government/index.html 与打包的 assets/
|
||||
root /var/www/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /government/index.html;
|
||||
}
|
||||
|
||||
# 若使用 alias,也请注意路径以 / 结尾,并保留回退
|
||||
# location ^~ /government/ {
|
||||
# alias /var/www/html/government/;
|
||||
# index index.html;
|
||||
# try_files $uri $uri/ /government/index.html;
|
||||
# }
|
||||
```
|
||||
|
||||
验证步骤:
|
||||
- 访问并刷新:`https://ad.liaoniuyun.com/government/farmer` 应正常显示页面,不再 404。
|
||||
- 如仍异常,检查是否有其它 `location` 块(例如 `/` 或正则)优先生效覆盖了 `/government/` 的回退配置;可通过 `^~` 提升优先级。
|
||||
- 确认 `vite.config.js` 已设置 `base: '/government/'`,且路由为 `createWebHistory('/government/')`(本项目已配置)。
|
||||
Reference in New Issue
Block a user