我将 nginx 配置为将单页 React.js 应用程序作为静态内容提供服务。react-router 处理浏览器中的路由。
为了能够让用户输入的所有URL(而不是域example.com,而且网址一样example.com/some/path,example.com/some/other/path等),直接在地址栏,我做的,
error_page 404 /index.html
Run Code Online (Sandbox Code Playgroud)
除了在 Internet Explorer 中,这在任何地方都可以正常工作。IE 为此显示 404 页面。
如果请求路径无法与根目录中的文件匹配,我该如何配置 nginx,使其服务于 index.html。
谢谢。
nginx ×1