2025-05-23

web

tutorial

Preamble

One day, like me, you decide to use something bit more stable to host your web related stuff which is intended for other people than yourself, like this blog site you are reading; deciding upon using .ee domain for once, which means no Cloudflare, Porkbun, Hover nor anything of the sort. And looking upon the list of accredited providers, someone that you already pay bills into, which most likely is the beloved and notorious Telia Eesti. You setup all fine and dandy, pay the fees, you create web app, blog site and/or something that depends on Node.js and get into realisation that your are stuck using their .php and only thing they provide giving you as an application is… WordPress. Now you are stuck and feeling buyers remorse picking a wrong web service provider… but fear not, as this guide will show a semi-jank way to get it to work!.

Caveats

This isn’t sunshine and rainbows either, so I will explain the following caveats:

Setting up the dashboard

Now finally into the meat of this, we have to setup the following thing at the dashboard:

  1. Go to your own selected domain, looking at the option selection bar, pick these to make a new subdomain. Webserver > Subdomains
  2. Create a new subdomain by clicking on the add subdomain, choose whatever you name you want it to be like blog in the Name selection and a random directory name to fill in the blank (We won’t be using this).
  3. Then after creating the file, enable the WWW alias added and fill in the mod_proxy backend port into the port number that you want to use that won’t conflict with the whole domain provision, which for safest bet is going to be port number 8080. Then save the changes.

Setting up the server in the terminal

After having setup the dashboard settings, we try to setup our server through the terminal after we have setup our SSH keys if we already have not done so.

Node.js Installation

This guide follows the official documentation from the web hosting provider , which asks us to do the following:

  1. To install the Node.js version manager nvm, we have to use the following installation script command.

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  2. Then refresh the bash, by terminating the session and logging back in (yeah, it is strange that usual bash command won’t do the magic).

  3. Then after logging back in. You can finally install either your wanted Node.js version in question or the latest one if it exists in the nvm. The commands are respectively like this:

    nvm install 24.0.1
    nvm install node
  4. Now you have successfully installed Node.js! And can do the following command like this PORT=8080 node ./your/start/script.mjs, where the PORT environment variable is important to make it accessible through the subdomain.

Although if you already don’t know how your package management works, then what I personally do is run the following commands of copying the package .json files, installing the dependencies and finally copying over the distribution.

# Copy package.json and package-lock.json to server  
scp ./package*.json "$SERVER_CONNECTION":~/  
  
# SSH into server and install dependencies  
ssh "$SERVER_CONNECTION" "cd ~/ && npm install --production"  
  
# Then copy the dist folder  
rsync -avz ./dist/ "$SERVER_CONNECTION":~/dist/

How to keep it persistent

Telia does not have a way to keep the usual PORT=8080 node ./your/start/script.mjs persistent after we terminate the session, so we have to setup the following in the terminal:

  1. Globally install the PM2 onto the server by:
    npm install -g pm2
  2. Start your application in question with PM2, remember to not forget the port number:
    PORT=8080 pm2 start ~/your/start/script.mjs --name my-app
  3. Save the process into the PM2:
    pm2 save

Now that it has been saved and started independent from the terminal, it still under the false sense of security assumption that Telia Eesti web hosting does not sometimes have restart sessions, migrations or technical difficulties where processes would have to be restarted. Luckily, we have the power to use our Crontab in the domain provider. So we need to do the following:

  1. In the domain setting menu bar select Crontab and click on Add New Crontab Job.
  2. Fill a Job name with something like PM2 Restart and Command with cd ~ && pm2 resurrect. Then select however you want to be notified and when and where. Then press Next
  3. Then fill the scheduling plan with how frequency you feel like you should refresh your website. Like choosing for example 0 0 0 */10 * * which means at 12:00 AM, every 10 days, restart the processes.