Wednesday, April 27, 2016

Nginx as a web server or Node JS with Cloudfront CDN

Leave a Comment

I have read many articles that the main advantage of using Nginx as a web server is that it fastens you performance, especially because it works fast with a static data.

I already uses Cloudfront CDN (Amazon Services) for fastening the static data.

So, do I have any real reasons to prefer using Nginx over Node JS as a web server?

2 Answers

Answers 1

No advantage in your case. Choosing a CDN to deliver your static content was a great idea. (CDN's not only serve your content, but they cache it around their network so most locales see equivalent performance.) This offloads a significant amount of labor from your NodeJS application server.

However NGINX can be very useful in conjunction with an application server like NodeJS. Most people use NGINX as a reverse proxy, that is it sits in front of a cluster of application servers and distributes traffic load evenly.

Other cool tricks include hotswapping NGINX configuration for blue green deployments; so you never have to halt your service for an upgrade.

If you have the money and the time these are tricks well worth having up your sleeve.

Answers 2

It depends what do you believe "real reasons" are.

I believe the most important reason includes security issues - Nginx is a dedicated web server, whereas Node.js is a JavaScript runtime, therefore Nginx focuses on serving-related issues, whereas Nodejs builtin server is just an additional utility, thus not receiving that much attention. Another benefit of such deployment is configurability - for example, you can switch your node runtimes with virtually no downtime (since you can run two nodejs instances at the same time) or even slowly move the traffic to your new server.

You can also take a look at: Using Node.js only vs. using Node.js with Apache/Nginx and http://blog.modulus.io/supercharge-your-nodejs-applications-with-nginx

Perhaps you may be interested in a more general question as well, regarding application servers vs web servers: What is the difference between application server and web server?

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment