Need tips on how to host a Node.js based web server on my Ubuntu system

Kaveencode

New Member
Joined
Feb 25, 2024
Messages
1
Reaction score
0
Credits
13
Hello, I want to host a React node.js based website on my dell t320 running Ubuntu 22.04.3
I don't know what's the best way to go about it so any tips or reference would be great
also, I would like to be able to set up like a script or something to pull the code from a GitHub branch so whenever the branch gets a new commit it pulls it and replaces the server with the code from the newest branch commit
 


You are asking a lot of questions. I would start simpler. Just about every distro already comes with nodejs and several react languages. Ubuntu typically runs slightly older versions of these. But that just means "more stable, more tested".
Arch and Fedora typically run newer versions, almost always the latest version. I would just let yum, yast, or apt handle
getting software and installing it. Installing it manually is a bit of a pain. Writing a github script is even more of a pain. ( I would do it with ansible personally ). Keep in mind some of the react languages have OS library dependencies that are a real pain to manage manually.

If you have node.js, you are going to want npm, and some of the modules that go with it. I really would just let the OS package manager handle this for the first try. Once you get familiar with the setup, then go manually if you want. If you have git ( the client ) installed, then it's a little easier, but you'll have to put github credentials in your script or create an API key.
Remember, you only get source code from github. That means you'll have to compile node.js and all the dependencies that go with it. Personally, I think this is a good exercise that everyone who uses Linux should go through at least once so they can appreciate how difficult it is.

Step two, is open the firewall on your web server. Typically ports 80 and 443. That will let other computers in your house, on the same network view pages on your web server.

If you want to host a public web site on the internet, that gets a little trickier. You'll need a public IP address from your internet provider ( usually an additional cost ) . If you want to be available with a DNS name. ( www.mycoolwebsite.com ) you'll have to register with a public DNS provider. I've heard there are "free" ones. But I really haven't ever found any. Generally there is some cost with this as well.
 
Last edited:

Members online


Top