3 ms·
Please excuse my ignorance, but why would I want to run nginx to proxy requests through?
by parasight 14y ago
Please excuse my ignorance, but why would I want to run nginx to proxy requests through?
- onewland 14y ago[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.
- javis 14y agoPossibly because Nginx serves static content much faster than Node.
- cparedes 14y agoThe 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.)
- Wintamute 14y agoIf 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.