Perfomancewise, does it make sense to redirect requests from an Apache VirtualHost to a Node.js instance? Does proxying counterbalance the awesome Node.js performance?

FYI: I also need a couple of PHP web apps to be parsed and run on the same machine, that's the only reason why I'm even considering using a reverse proxy.

According to my research, Nginx has less overhead and thus performs slightly better but unfortunately doesn't support HTTP/1.1.

I also thought about having Node.js serve as the reverse proxy and sending certain requests to Apache (which then processes PHP files, for example), but I heard that there could be lots of security issues.

2 Answers 2


I would suggest that setting up Apache to reverse proxy to Node.js is against the intent of Node.js. Node is very lightweight - its overhead is minimal. Launching an apache process to handle the Node.js stream negates the point of using Node.js (essentially, you would be limited by the performance of Apache).

Node is sometimes not considered stable enough to run without monitoring and might not be the ideal front end. I might suggest placing either Squid or HAproxy in front of Node and Apache, allow either of those to serve as your proxy, and run Node and Apache on different ports (e.g. 8080, 8081). Both Squid and HAProxy have good performance and should meet your needs without detracting from either backend server.


You shouldn't use Apache to proxy node.js. Part of node's speed is gained from handling its own socket I/O with minimal overhead: this would be negated by proxying with any other server.

Instead you can proxy requests to Apache from node using the excellent node-http-proxy from nodejitsu - the second example "Setup a stand-alone proxy server with custom server logic" is suitable for your use case.

edit: I actually set up a PHP/node install the other day using nginx and php-fpm, there are full instructions here. You can also run a reverse proxy from nginx and allow node to handle its own connections simultaneously.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .