Does it make sense to reverse proxy Node.js through Apache?

Solution 1:

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.

Solution 2:

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.