【发布时间】:2020-10-22 08:13:09
【问题描述】:
我有 2 个使用 React Router 的不同 React 应用程序。我的 Nginx conf 中有以下结构:
# This is to serve main React App
location / {
root /apps/www;
index index.html index.htm;
try_files $uri /index.html;
}
# This is to serve secondary React App
location /report {
root /apps/www/report;
try_files $uri =404;
}
我已将两个构建文件放在相应的根文件夹中。
但是,当我打开 https://hostname/report 时,它没有转到辅助 React 应用程序,而是转到主应用程序,由其 React 路由器处理,然后重定向到 NotFound 页面。
如何让 Nginx 位置处理到/apps/www/report 的路由?
【问题讨论】:
标签: reactjs nginx react-router