How to setup Ubuntu 23.04 to host NodeJS based apps

server
1 min read
Wondering what are some of the very first things to be done on an Ubuntu server before you start setting up your server to host your apps.
I was recently setting up a VPS to host one of my websites based on NodeJS, so I thought of sharing a series of posts on how I actually set up my server to host Next.JS sites in production.
This post tries to capture the various components required and a series of steps that are the bare minimum required for a NodeJS based application to be deployed.
10 steps to setup a Ubuntu server to host NodeJS application:
- Update Ubuntu
- Add the server’s SSH key to GitHub to pull the latest code
- Install the latest LTS node
- Install Yarn
- Install PM2
- Starting a NodeJS based app via PM2
- Install Nginx and update the server's firewall
- Reverse proxy a NodeJS based app via Nginx
- Install Certbot for HTTPS
- Enable HTTP/2 for better performance