在React项目中我们经常需要采用React-Router来配置我们的页面路由,React-Router 是建立在 history 之上的,常见的history路由方案有三种形式,分别是:

  1.hashHistory

  2.browserHistory

  3.createMemoryHistory

如果使用hashHistory ,访问的页面url如 example.com/#/some/path 的路由。

于是采用第二种browserHistory,但是部署到自己的服务器之后,可以正常访问,但是强制刷新页面之后报404找不到页面路径

Nginx配置方式如下

server {
server_name react.thinktxt.com;
listen 80; root /Users/txBoy/WEB-Project/React-Demo/dist;
index index.html;
location / {
try_files $uri /index.html;
}
}
访问后刷新,解决404问题

最新文章

  1. peer not authenticated error
  2. mapreduce 模板
  3. dubbo 管理控制台 的安装 dubbo-admin
  4. device unauthorized & ANDROID_ADB_SERVER_PORT 问题解决
  5. Google Code Jam 2010 Round 1C Problem B. Load Testing
  6. yii的常用配置文件
  7. C# JSON字符串序列化与反序列化
  8. C++ 文件读写方案选型
  9. @SuppressWarnings(unchecked)作用解释
  10. C++指针的操作和运算(转)
  11. vc根据域名获取IP地址 gethostbyname()函数
  12. json解包与json封包
  13. dm-verity
  14. SQLite3创建数据库的方法
  15. 初次认识dedecms和帝国cms内容管理系统
  16. oracle登陆提示“ora-01031 insufficient privileges”
  17. hive的jdbc使用
  18. JSON数据的解析和生成(Swift)
  19. mapreduce中控制mapper的数量
  20. centos7下安装配置redis3.0.4

热门文章

  1. VS2015配置环境支持opencv3库(网络方法总结)
  2. Mac电脑jsp连接mysql
  3. C/C++ 弱符号
  4. SpringSecurity配置文件
  5. Qt类库介绍
  6. docker安装(yum方式)
  7. <input type="image">表单提交2次 重复插入数据问题
  8. Prometheus集群介绍-1
  9. 风炫安全WEB安全学习第十七节课 使用Sqlmap自动化注入(一)
  10. Mirai框架qq机器人教程 新版