6 ms·
Node.js + Apache
- deleted 16y ago[deleted]
- aaronblohowiak 16y agodon't do this if you want to use websockets: they won't work behind apache. Don't do this if you want to use long-polling on a moderately trafficked site: it will use way too much memory (nginx is fine for long polling, but still breaks websockets.) the current websockets draft sucks.
- fookyong 16y agoCorrect me if I'm wrong but by the time .htaccess is processed to see where to route the user to, you're already using Apache resources. So while you can run the two together like this, Node.JS will ultimately be confined to the same scale limitations as Apache. So you lose a lot of the benefit. Or am I wrong?
- kennu 16y agoThat's right, you tie up an Apache process/thread to proxy each connection, so pretty soon you run out of them. And the whole point of Node.js is to run I/O asynchronously without tieing up a thread for it. A better alternative would be to run e.g. Varnish in front of both Apache and Node.js. Then you can forward requests to any backend server you like in an efficient manner (using pipe mode for long polling requests).
- rgbrgb 16y agoThanks for the info!
- deleted 16y ago[deleted]
- mike-cardwell 16y agoVarnish is good unless you need SSL. IIRC Varnish still doesn't support SSL, and the author never intends it to. I'm not suggesting that's a bad thing, just saying.
- jimmyjazz14 16y agoApache is probably not the best choice to use as a reverse proxy to Node.js. One would probably have better luck with Nginx or something with a similar asynchronous design as node.