Host multiple node apps on a single domain

upstream rootApp {  
  server 127.0.0.1:3000;
  keepalive 16;
}

upstream otherApp {  
  server 127.0.0.1:2368;
  keepalive 16;
}

server {  
  listen 80;

  server_name www.yourdomain.com;
  return 301 $scheme://yourdomain.com$request_uri;
}

server {  
  listen 80 default_server;

  server_name yourdomain.com;

  location / {
    root /var/www/yourdomain/rootApp;
    proxy_redirect off;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Host             $http_host;
    proxy_set_header   X-NginX-Proxy    true;
    proxy_set_header   Connection "";
    proxy_http_version 1.1;
    proxy_pass         http://rootApp;
  }

  location /otherApp {
    root /var/www/yourdomain/otherApp;
    proxy_redirect off;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Host             $http_host;
    proxy_set_header   X-NginX-Proxy    true;
    proxy_set_header   Connection "";
    proxy_http_version 1.1;
    proxy_pass         http://otherApp;
  }

}