Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the benefit of using NginX for Node.js?

Tags:

node.js

nginx

From what I understand Node.js doesnt need NginX to work as a http server (or a websockets server or any server for that matter), but I keep reading about how to use NginX instead of Node.js internal server and cant find of a good reason to go that way

like image 950
Purefan Avatar asked Jul 06 '10 12:07

Purefan


People also ask

What is the advantage of using Nginx?

NGINX is one of the most popular web servers and reverse proxies available today. It offers high performance, almost infinite configurability, and is a commonly used component in modern stacks like Kubernetes.

Should I use Nodejs or Nginx?

Conclusion. Node. js is a JS runtime environment that is also an HTTP server with some event-driven features and has many drawbacks in terms of concurrency and high load or user requests to handle a large number of users concurrently. Nginx has the best performance in this case, and it provides the best performance.

What is the purpose of using Nginx?

NGINX Beyond Web Serving Because it can handle a high volume of connections, NGINX is commonly used as a reverse proxy and load balancer to manage incoming traffic and distribute it to slower upstream servers – anything from legacy database servers to microservices.

Does Nginx have node JS?

If you are installing and configuring NGINX Open Source or NGINX Plus on a fresh Linux system and using it only to load balance Node. js traffic, you can use the provided file as your main configuration file, which by convention is called /etc/nginx/nginx.


2 Answers

Here http://developer.yahoo.com/yui/theater/video.php?v=dahl-node Node.js author says that Node.js is still in development and so there may be security issues that NginX simply hides.
On the other hand, in case of a heavy traffic NginX will be able to split the job between many Node.js running servers.

like image 153
mbq Avatar answered Oct 01 '22 00:10

mbq


In addition to the previous answers, there’s another practical reason to use nginx in front of Node.js, and that’s simply because you might want to run more than one Node app on your server.

If a Node app is listening on port 80, you are limited to that one app. If nginx is listening on port 80 it can proxy the requests to multiple Node apps running on other ports.

It’s also convenient to delegate TLS/SSL/HTTPS to Nginx. Doing TLS directly in Node is possible, but it’s extra work and error-prone. With Nginx (or another proxy) in front of your app, you don’t have to worry about it and there are tools to help you securely configure it.

like image 20
Nate Avatar answered Oct 01 '22 00:10

Nate