nodejh
7/1/2018 - 12:48 PM

browserhistory nginx config spa

browserHistory Browser history 是使用 React Router 的应用推荐的 history。它使用浏览器中的 History API 用于处理 URL,创建一个像example.com/some/path这样真实的 URL 。

https://react-guide.github.io/react-router-cn/docs/guides/basics/Histories.html


如果你的服务器是 nginx,请使用 try_files 指令:

server {
  ...
  location / {
    try_files $uri /index.html
  }
}