Answer the question
In order to leave comments, you need to log in
How to open a Node.js webserver for web access?
How to open a Node.js webserver for web access?
Answer the question
In order to leave comments, you need to log in
As an option for experiments and hamsters:
1. Buy a domain name (for example , here , although the choice is of course yours. In the .ru zone, about 600 rubles per year)
2. Get a static IP (buy from a provider, about 50 rubles per month), or set up something like ddns (almost all modern routers can do it through their webcam).
3. In the case of a static IP, configure the binding of the purchased domain name to your static IP. To do this, rummaging through the website of the office that sold you the domain name to find a DNS service for their clients. Most people use this service for free.
In the case of ddns and the like, set up the binding of the purchased domain name to your account in the ddns service
4. Buy something like raspbery PI or orange PI, install something like armbian, nodejs on it, connect it to the router, configure the IP in the local area (the item is not required, but the convenience is undeniable, it hangs silently on the wall near the router, nailed and distributes your sites in no :).
5. Forward the necessary ports in the router to the IP of your server (raspbery PI or orange PI) (note that the external port will be 80 and the internal port on the server is most likely 3000. The internal port number depends only on which port you run your nodejs application on)
6 .Profit!!! As soon as the DNS records are updated (from a couple of minutes to a day, depending on the chosen DNS service), you, and the whole world together with you, will be able to visit your nodejs application at http://your_domain.zone/
PS: Then you will only have to:
1. Take care of https ( Let's Encrypt to help you)
2. Register several subdomains in your domain (for example, forum.your_domain.zone, game.your_domain.zone, chat.your_domain.zone, cloud.your_domain.zone). The good news is that with most services, maintaining your domain name and registering subdomains is free (unless of course you are their client - you bought a domain name from them)
3. Install nginx on the server and configure it to transfer http requests to https, check certificates itself and distribute incoming requests to the corresponding services already in the local area and via http. (of course, you can be puzzled that the services on the node check their certificates themselves, but in my opinion this is pointless, because if someone hacks your server, he will not care if the packets between your nginx and the services on the node go through lo0.
Upload the application to a server such as http://netbreeze.net or digitaloucean. And then you want to build the architecture, a distributed client-server application via http or your back on the node will generate a client and send it to the browser. Don't forget about setting up nginx, see the digitaloucean docs for details on setting up a server.
https://www.digitalocean.com/community/tutorials/n... about Nginx
It is better to use Linux (Ubuntu) as a server.
** on your computer, if anything, without buying a static IP, you won't be able to deploy the application so that it can be seen all over the Internet. Yes, and there is no point, there are quite a lot of problems with the smooth operation of the server, the hoster will be more reliable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question