Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to set up multiple node.js servers on the same machine (but listening on different ports) for different projects (so I can pull any down to edit code without affecting the others). However I want to be able to access these web apps from a browser without typing in the port number, and instead map different urls to different ports: e.g. ->

I've considered using node-http-proxy for this, but it doesn't yet support SSL. My hunch is that nginx might be the most suitable. I've never set up nginx before - what configuration do I need to do? The examples of config files I've seen only deal with subdomains, which I don't have.

Alternatively, is there a better (stable, hassle-free) way of hosting multiple apps under the same IP address?

share|improve this question

First start with reading the wiki documentation. It's very thorough and includes samples. I won't give you an entire nginx config, but here is the relevant portion to your question.

server {
    listen 80;

    location /foo {
        proxy_pass http://localhost:9000;

    location /bar {
        proxy_pass http://localhost:9001;

    location /baz {
        proxy_pass http://localhost:9002;

It should be clear what's going on there. Each location proxies the specified URI to the appropriate node.js backend.

share|improve this answer

nginx might be the way to go. At least, that is what I have running on my server. An example config/description can be found here:

You basically set up different sites in nginx and each site routes his traffic to a nodejs app running on a different port.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.