Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

So currently my linode (ubuntu 11.10) serves up three node.js apps for me using connect's vhost middleware listening on port 80. Here is an example of how vhost sets up a domain:

var portfolio = require('./bootstrap-portfolio/lib/app.js');

var server = express();



However I would now like to add a wordpress installation to my vps as well. In the past for me this has meant a traditional apache installation; however I'm a bit unsure of how node.js + a different webserver (apache or nginx) should interact.

Any thoughts on how I should approach hosting wordpress + node.js on the same box?

share|improve this question

I'm not sure of any other solutions to this, but you could try a reverse proxy set-up. You could so a similar thing in Nginx but the example uses Apache.

If you install Apache (for example) and configure it to listen on port 80, you can also configure Apache's mod_proxy to forward requests onto your Node.js apps. This is known as a reverse proxy. But since Apache would then be binding to port 80, you would need to pick a different port number for your app to bind to.

For each of your Node.js applications you'll need to configure a virtual host with a ProxyPass entry (see

<VirtualHost *:80>
  ProxyPass / http://localhost:8080/

Now when Apache recieves a request that matches that VHost, it will forward it on to the Node.js middleware which will, in turn service the request and send it back to Apache.

Of course if you are not so bothered about having everything connect on the default port (80) then you could just have them running side-by-side and ensure you include the port number when accessing the server on any other 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.