Q: Nginx - Two locations inside same server I'm serving 2 Angular apps inside same server block, production and demo.
I created the folders /var/www/myapp/demo e /var/www/myapp/prod
So when I type localhost/ should be serve prod and locahost/demo serve demo
I try the following config
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    index index.html;

    server_name _;

    root /var/www/myapp;

    location / {
        root /var/www/myapp/prod;
    }

    location /demo {        
        root /var/www/myapp/demo;
    }

} 

And no success. 
I trid others variations, but nothing until here
How can i configure my server block to make this work.
Thanks

A: In nginx, the path specified in location is added after the directory specified in root.
So, in this case nginx tries to load your demo version from /var/www/myapp/demo/demo.
This configuration should work provided that your configuration for the application server is correct in nginx.
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    index index.html;

    server_name _;

    location / {
        root /var/www/myapp/prod;
    }

    location /demo {
        root /var/www/myapp;
    }
}

