2
我想在我的Nginx服务器的子文件夹中部署一个React应用程序。如何配置我的Nginx服务器以使用子文件夹中的React应用程序?
此React应用的位置结构如下:www.example.com/reactApp。
我试图建立我目前nginx.conf像这样:
server {
..other configs..
location /reactApp {
root /var/www;
index reactApp/index.html;
try_files $uri $uri/ /index.html;
}
..other configs..
}
这没有奏效。我需要更改什么来修复我的子文件夹路由?
你可以将反应路由器上的基名设置为'/ reactApp'吗? https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string –