Re:Drop Root Privileges in Node.js after Binding to Port 80
by wonnage on Tuesday December 04, 2012 @05:04PM
(#4873527)
It's probably a better idea to just run nginx on port 80 and proxy requests through in any sort of real environment. And if you're not in production...well, it doesn't really matter which port you choose anyway.
[ Parent
| on HN ]
Re:Drop Root Privileges in Node.js after Binding to Port 80
by m0th87 on Tuesday December 04, 2012 @05:18PM
(#4873602)
Unless you want websocket support. Then it gets a little more complicated: http://stackoverflow.com/questions/10329281/nginx-1-2-0-sock...
Re:Drop Root Privileges in Node.js after Binding to Port 80
by Pewpewarrows on Wednesday December 05, 2012 @09:19AM
(#4876316)
Afaik, Disqus uses websockets with Nginx fine. I believe they recently mentioned writing and using this module: https://github.com/wandenberg/nginx-push-stream-module
Re:Drop Root Privileges in Node.js after Binding to Port 80
by jeromeparadis on Wednesday December 05, 2012 @01:01AM
(#4875118)
HAProxy works Wellington for node.js websocket apps.
Re:Drop Root Privileges in Node.js after Binding to Port 80
by parasight on Tuesday December 04, 2012 @05:13PM
(#4873579)
Please excuse my ignorance, but why would I want to run nginx to proxy requests through?
Re:Drop Root Privileges in Node.js after Binding to Port 80
by onewland on Tuesday December 04, 2012 @05:18PM
(#4873601)
[This response is a guess, and very generalized]
You probably won't handle every HTTP edge case as well as nginx defaults, and you don't really need the control at that level to implement a functional, high performance web app.
Re:Drop Root Privileges in Node.js after Binding to Port 80
by cparedes on Tuesday December 04, 2012 @05:24PM
(#4873645)
The reasons that other folks have mentioned (static files, nginx is built for lots of HTTP requests), as well as basic load balancing between several 'worker processes'. Sometimes you'll want to have several app server processes running with several ports open, and have nginx load balance between all of those processes (then load balance again at a higher tier between all of the different nginx processes.)
Re:Drop Root Privileges in Node.js after Binding to Port 80
by javis on Tuesday December 04, 2012 @05:19PM
(#4873609)
Possibly because Nginx serves static content much faster than Node.
Re:Drop Root Privileges in Node.js after Binding to Port 80
by Wintamute on Tuesday December 04, 2012 @05:39PM
(#4873725)
If you're running a few services and sites on the same box you need some sort of proxy listening on port 80 reverse proxying incoming requests to the correct internal port. i.e. an incoming request looking for "www.mynodeapi.com" could be internally routed to "127.0.0.1:8080" (or wherever your node app is listening). The proxy could be nginx, haproxy or perhaps even a node app using node-http-proxy. AFAIK, if you need proper web sockets support your proxy has to be node based or haproxy.