Node.js 如何为同一服务器上的三个应用程序配置我的nginx配置文件
您好,我有三个应用程序(react、angular和node),我想将我的nginx文件配置为: mysite.com用于react,mysite.com/admin用于angular,pmysite.com/api用于node应用程序Node.js 如何为同一服务器上的三个应用程序配置我的nginx配置文件,node.js,reactjs,angular,nginx,Node.js,Reactjs,Angular,Nginx,您好,我有三个应用程序(react、angular和node),我想将我的nginx文件配置为: mysite.com用于react,mysite.com/admin用于angular,pmysite.com/api用于node应用程序 #node app location /api/ { proxy_pass http://127.0.0.1:3000; access_log /var/log/nginx/mysite.log;
#node app
location /api/ {
proxy_pass http://127.0.0.1:3000;
access_log /var/log/nginx/mysite.log;
error_log /var/log/nginx/mysite_error.log;
}
#angular app
location /admin {
root /var/www/mysite/backoffice/dist/index.html;
access_log /var/log/nginx/mysite_bo.log;
error_log /var/log/nginx/mysite_bo.log;
}
location ~ \.(aac|m3u8|ts) {
root /var/www/mysite/media;
}
location /uploads/ {
root /var/www/mysite/;
}
#react app
location / {
proxy_pass http://127.0.0.1:3006;
access_log /var/log/nginx/mysite_react.log;
error_log /var/log/nginx/mysite_react.log;
}}
/admin not working it redirect to/any solution?在
位置/admin
块下的根路径作为所有后续匹配该模式的请求的基本路径。看起来您已经硬编码了/admin
路径以提供单个文件/var/www/mysite/backoffice/dist/index.html
尝试更改它以查看此操作是否有效:
location /admin {
root /var/www/mysite/backoffice/dist; # change to this
access_log /var/log/nginx/mysite_bo.log;
error_log /var/log/nginx/mysite_bo.log;
}
问题是/管理员重定向到/(反应应用程序)