修复了一些Bug
This commit is contained in:
35
README.md
35
README.md
@@ -15,3 +15,38 @@ npm run dev
|
||||
```shell
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 对于Nginx服务器需要添加以下配置:
|
||||
找到你站点 Nginx 配置文件,通常位于 `/etc/nginx/nginx.conf` 或 `/etc/nginx/conf.d/` 目录下。
|
||||
|
||||
核心配置内容:
|
||||
```nginx
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
```
|
||||
|
||||
示例:
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your-domain.com;
|
||||
root /你的部署目录/dist; # 指向你构建产物的目录
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html; # 关键配置
|
||||
}
|
||||
|
||||
# 静态资源缓存(可选,提升性能)
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
它的含义是:
|
||||
1. 先尝试查找请求的文件($uri)
|
||||
2. 再尝试查找请求的目录($uri/)
|
||||
3. 都找不到就返回 index.html,让 Vue Router 接管路由
|
||||
|
||||
Reference in New Issue
Block a user