To get this version, you can use the
apt
package manager. Refresh your local package index first:
sudo apt update
Then install Node.js:
sudo apt install nodejs
Check that the install was successful by querying
node for its version number:
node -v
Output
v10.19.0// or more
If the package in the repositories suits your needs, this is all you need to do to get set up with
Node.js. In most cases, you’ll also want to also install
npm , the Node.js package manager. You can
do
this by installing the
npm package
with
apt :
sudo apt install npm
This allows you to install modules and packages to use with Node.js.
At this point, you have successfully installed Node.js and npm using apt and the default Ubuntu software
repositories. The next section will show how to use an alternate repository to install different
versions of Node.js.
sudo apt install nginx
sudo nano /etc/nginx/sites-available/default
Add the following to the location part of the server block
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://localhost:5000; #whatever port your app runs on
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
after edit click
Ctrl+s to save
and
Ctrl+x to exit
# Check NGINX config
sudo nginx -t
# Restart NGINX
sudo service nginx restart
You should now be able to visit your IP with no port (port 80) and see your app. Now let's add a domain