Welcome! Log In Create A New Profile

Advanced

Nginx multiple locations same server

Posted by vardanplay 
Nginx multiple locations same server
October 28, 2023 05:41PM
Dear community,
I'm trying to setup nginx configs this this logic (Nginx multiple locations same server).

core "/" and "api" work, but "/admin" does not open new UI, it's the same "/".Can some one help to fix this small issue. User and Admin UI is different React app.

I did research, asked in stcakoverflow, GPT-3.5 but still it does not work.

https://stackoverflow.com/questions/77369018/nginx-multiple-locations-same-server-doesnt-work


www.domain.com
www.domain.com/admin
www.domain.com/api


server {
listen 80 default_server;
listen [::]:80 default_server;

index index.html index.htm;
server_name _;

# react app & front-end files
location / {
root /opt/client/build;
try_files $uri /index.html;
}

location /admin {
alias /opt/admin/build;
try_files $uri /index.html;
}

# node api reverse proxy
location /api {
proxy_pass http://localhost:5000/;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 128
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready