React部署到线上Nginx环境中刷新页面后404解决方案

我们需要在Nginx的配置文件中修改以下内容(通常Nginx配置文件位置为/etc/nginx/nginx.conf):

server {
  # ...

  location / {
    # ...
    # 增加下列命令,index.html可换为项目中使用的其它文件名
    try_files $uri $uri/ /index.html;
  }
}

在修改后使用nginx -s reload命令加载修改后的配置即可。

来源https://blog.csdn.net/ghosind/article/details/108006554

用自己私人的服务测试吧

原文地址:https://www.cnblogs.com/hiit/p/14841928.html