Answer the question
In order to leave comments, you need to log in
Server on Node.js?
Hello everyone, help a newbie to understand.
There is a VPS installed Debian and Node.js on it. How to raise a full-fledged web server on Node.js, as I understand it, you need to install http-server. Tell me what steps you need to take to make it work, the task of such a server will be to host websites, the backend of which will be written in Js, and a node application.
Please help anyone understand.
Answer the question
In order to leave comments, you need to log in
With node.js it's the other way around, it has the web server "inside" the applications, not the applications "inside" the web server. Each application is itself a web server. To make virtual hosts, host many sites, handle many domains, you need to run many node instances and link this whole zoo into one bundle through nginx. If each application assumes a decent load, then each one needs to be parallelized using cluster
and then these clusters are already combined through nginx. As a result, if you have 20 sites on a machine, then these are at least 20 node processes, or even all 100. There is an alternative solution - an application server that turns the world back on its head, i.e. there are many applications on the model "inside" the application server: habrahabr.ru/post/247543
nodejs.org/api/synopsis.html
nodejs.org/api/http.html#http_class_http_server
It's better to proxy all this through nginx.
Start using Docker+Dokku, install the haproxy or nginx balancer there. Everything works almost out of the box.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question