更新README

This commit is contained in:
database-mysql committed 2026-09-02 19:55:41 +08:00
1 parent 36a37bb6e3
commit 5d06560a08
1 file changed
+25 -12
+25 -12
View File
@@ -17,16 +17,9 @@ npm run build
```
### 对于Nginx服务器需要添加以下配置:
找到你站点 Nginx 配置文件,通常位于 `/etc/nginx/nginx.conf` 或 `/etc/nginx/conf.d/` 目录下。
核心配置内容:
```nginx
location / {
try_files $uri $uri/ /index.html;
}
```
找到你站点 Nginx 配置文件(通常在 `/etc/nginx/conf.d/xxx.conf` 或 `/etc/nginx/sites-available/xxx`),在 `location /` 块中添加 `try_files`:
示例:
```nginx
server {
listen 80;
@@ -46,7 +39,27 @@ server {
}
```
它的含义是:<br/>
1. 先尝试查找请求的文件($uri)<br/>
2. 再尝试查找请求的目录($uri/)<br/>
3. 都找不到就返回 index.html,让 Vue Router 接管路由<br/>
**核心就是这一行:**
```nginx
try_files $uri $uri/ /index.html;
```
它的含义是:
1. 先尝试查找请求的文件(`$uri`)
2. 再尝试查找请求的目录(`$uri/`)
3. 都找不到就返回 `index.html`,让 Vue Router 接管路由
## 生效步骤
修改完配置后,执行:
```bash
# 检查配置语法是否正确
nginx -t
# 重新加载配置(无需重启)
nginx -s reload
```
配置生效后,直接访问 `/help` 就不会再 404 了。