Deploying Behind Nginx Proxy

236 views
Skip to first unread message

Saransh Mohapatra

unread,
Jul 14, 2013, 2:32:28 PM7/14/13
to expre...@googlegroups.com

I am looking to deploy an express app that I have developed. I have read about deploying express app with an Nginx Proxy and also know that it's not a requirement. I have also read that express on its own is a very good with super fast speed.

So I want to know What are the advantages of deploying it behind a proxy server like Nginx? Certain areas where I want to know the advantages and disadvantages are Speed, Security, Static File Serving, FileServing after authentication.

Hage Yaapa

unread,
Jul 14, 2013, 4:12:04 PM7/14/13
to expre...@googlegroups.com
Nginx is a specialized system, while Express (Node.js) is relatively generic in nature, hence it is understood Nginx will do a better job. Also, modules in Express/Node are comparatively new / based on JS, and may not as stable / performant as those in Nginx. Besides, you spare Express from wasting CPU, which is better spent on handling things more relevant to it.

Express is best used for handling app-level IO, rather than caching, serving files, data compression, TLS etc. Not that it cannot, but it is best recommended for orchestrating app-level IO.

An additional advantage is that, if your upstream Express app is down, Nginx can still serve a webpage with some meaningful information, rather disappear temporarily from the face of the Internet.

In case you didn't know, I wrote a book on Express recently, and the last chapter deals with Express on production, which includes front-facing proxies. Related website: http://expressjs-book.com/  


On Mon, Jul 15, 2013 at 12:02 AM, Saransh Mohapatra <saran...@gmail.com> wrote:

I am looking to deploy an express app that I have developed. I have read about deploying express app with an Nginx Proxy and also know that it's not a requirement. I have also read that express on its own is a very good with super fast speed.

So I want to know What are the advantages of deploying it behind a proxy server like Nginx? Certain areas where I want to know the advantages and disadvantages are Speed, Security, Static File Serving, FileServing after authentication.

--
You received this message because you are subscribed to the Google Groups "Express" group.
To unsubscribe from this group and stop receiving emails from it, send an email to express-js+...@googlegroups.com.
To post to this group, send email to expre...@googlegroups.com.
Visit this group at http://groups.google.com/group/express-js.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bent Cardan

unread,
Jul 22, 2013, 11:01:41 AM7/22/13
to expre...@googlegroups.com
NGINX also listens in on unix sockets. When we initialize our node/express process we can relay app-level I/O to NGINX over domain sockets by passing in a directory PATH instead of a TCP port number on the app's http.listen call. http://nodejs.org/api/http.html#http_server_listen_path_callback  Then just make sure your nginx.conf file (conventionally symbolically linked from the sites-enabled directory), provides the upstream block to the same PATH unix:/directory/express/is/on. The unix domain socket expands overall application throughput by an order of magnitude when compared to TCP on the same or similar machine. Redis benchmarking observes the unix socket offering about twice as much throughput compared the same process over TCP. e.g., the section entitled Factors impacting Redis performance, see 3rd bullet point from the bottom: http://redis.io/topics/benchmarks
Reply all
Reply to author
Forward
0 new messages