Skip to content

update deployment.md #6487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/zh/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ serve -s dist

### 使用 `history.pushState` 的路由

如果你在 `history` 模式下使用 Vue Router,是无法搭配简单的静态文件服务器的。例如,如果你使用 Vue Router 为 `/todos/42/` 定义了一个路由,开发服务器已经配置了相应的 `localhost:3000/todos/42` 响应,但是一个为生产环境构建架设的简单的静态服务器会却会返回 404。
如果你在 `history` 模式下使用 Vue Router,是无法搭配简单的静态文件服务器的。例如,如果你使用 Vue Router 为 `/todos/42/` 定义了一个路由,开发服务器已经配置了相应的 `localhost:3000/todos/42` 响应,但是一个为生产环境构建架设的简单的静态服务器会返回 404。

为了解决这个问题,你需要配置生产环境服务器,将任何没有匹配到静态文件的请求回退到 `index.html`。Vue Router 的文档提供了[常用服务器配置指引](https://router.vuejs.org/zh/guide/essentials/history-mode.html)。

Expand Down