How do I run multiple node servers on one droplet?

Posted February 7, 2015 3.3k views


I have a domain (referenced as and I’m trying to run a couple of node apps on it like

When I start the node server and og to, I get “Cannot GET /node”.

The node app is in the following folder: var/www/

My conf file in ‘sites-available’ for nginx is this:

server {
    return 301 $scheme://$request_uri;

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/;
    index index.html index.htm;

    # Make site accessible from http://localhost/

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;

    location /node {
            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;

Can you please tell me what I’m doing wrong?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Try adding the following line after location /node {:

rewrite /node/(.*) /$1 break;

and reloading nginx.