使用Nginx在同一域名上进行不同位置的多种配置(React App)。

问题描述 投票:-1回答:1

我试图为两个不同的地方配置Nginx。这是我的情况。

www.example.com 
location : /var/www/example.com

example.com/panel 
location : /var/www/example.com/panel 
django reactjs nginx nginx-location nginx-config
1个回答
0
投票

尝试使用。http:/nginx.orgendocshttpngx_http_core_module.html#try_files。

location ^~ /root {
    root /var/www/example.com;
    index index.html index.htm;
}
location ^~ /root/react_app(or panel) {
    root /var/www/example.com;
    index index.html index.htm;
    try_files $uri $uri/ /root/react_app/index.html;
}
© www.soinside.com 2019 - 2024. All rights reserved.