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'm currently hosting my node applications with express (after a simple proxy passes them off)

var httpProxy = require('http-proxy');
var http = require('http');
var express = require('express');

httpProxy.createServer(function (req, res, proxy) {
    var nodeVhosts = [""]
    var host = req.headers['host'];

    var port = nodeVhosts.indexOf(host) > -1
        ? 8080  //must be a node vhost so pass it to :8080
        : 9000; //must be an apache vhost so pass it to :9000

    proxy.proxyRequest(req, res, {host: 'localhost', port: port});

var app = express();
var server = http.createServer(app);

var site = require('./site/app.js').site
app.use(express.vhost('', site));


I'm looking to add nginx as the front-end of this machine and wanted to see if I should even use express once I make the switch. In my current configuration I'll use nginx to replace the http proxy part that decides who the vhost belongs to (node or apache). But if I took it one step further and had node web apps hosted w/ nginx instead of express ... would this be a good idea or not?

Also -a little background about my usage of the node web apps. I plan to do full stuff and express (in it's current form doesn't pass along the upgrade request so node apps hosted this way always drop back to long polling sadly)

Thank you in advance

share|improve this question
I thought http-proxy is currently faster than nginx proxy – EhevuTov Aug 14 '12 at 19:35
Interesting -so in your opinion should I stick with the above instead of adding another web server to the mix? I'm using apache for simple wsgi python apps but wanted a fast friendly web server for node development (fyi) – Toran Billups Aug 15 '12 at 0:08
I'd try the http-proxy first. DotCloud recently switched from Nginx to http-proxy-based Hipache. See this article: – EhevuTov Aug 15 '12 at 0:21

Check out Hipache: a distributed HTTP and websocket proxy. It uses http-proxy as a module and does basically what Ngnix does. I'm not 100% sure about performance, but DotCloud recently switched from Nginx.

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.