I would like to to route requests based on a path to two different Angular applications. So when i request http://example.com/admin is routes to one app http://example.com/client routes to the second app. I have the following config but all requests are always sent to the nginx default page. Configuration is as follows:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location /admin {
root /home/ubuntu/apps/admin/;
index index.html;
try_files $uri $uri/ /index.html?$args;
}
location /client {
root /home/ubuntu/apps/client;
index index.html;
try_files $uri $uri/ /index.html?$args;
}
}
No other confs are in /etc/nginx/sites-enabled and nginx.conf is default post install on Ubuntu. Any help is appreciated.
/home/ubuntu/apps/admin/index.htmland/home/ubuntu/apps/client/index.html?aliasinstead ofroot? Also, you don't need$uri/with a trailing slash. Perhaps you don't need routing at all - simply set therootoutside of anylocationblock and then use a singlelocation /block with justtry_files$argsis the only thing that worked. Thanks for the help.