Host multiple node.js applications on Digital Ocean using NginX

I followed this guide to setup a reverse proxy for my node apps - https://www.digitalocean.com/community/tutorials/how-to-host-multiple-node-js-applications-on-a-single-vps-with-nginx-forever-and-crontab

The gist of it is to include this configuration

server {
    listen 80;

    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

This seems to work for the root location - / , but fails when I add a custom folder path. Something like this -

server {
    listen 80;

    server_name your-domain.com;

    location /test/ {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

}

My aim is to navigate to my site using example.com/test/ , so that I can list multiple paths for programs. The error I get from chrome is cannot GET example.com/test/

The port in proxy_pass needs to be different for each app. You can also refer to this digital ocean article

 server {
        listen 80;

server_name your-domain.com;

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

location /test {
    proxy_pass http://localhost:3009;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
}