react.js application showing 404 not found in nginx server

后端 未结 7 2276
广开言路
广开言路 2020-12-05 10:07

I uploaded react.js application to server. I\'m using nginx server. Application is working fine. But when I go to other page & refresh, site is not working. It\'s showin

7条回答
  •  情话喂你
    2020-12-05 10:40

    The problem comes when you are in a path for eg http:///some/path and you hit refresh you get a 404 error page. This extra line in the ngnix configuration could solve the issue.

    location /{
                    try_files $uri $uri/ /index.html?/$request_uri;
              }
    

    After adding do a nginx service restart.

提交回复
热议问题