How to host static site using pm2
PM2 is a process manager for node.js applications. You can use PM2 to host static websites.
To host a static website, create a folder, and put your files inside.
mkdir /home/website
Let’s create a static file, say index.html
echo "Welcome" > /home/website/index.html
Now you can make the site live using the following pm2 command
pm2 serve /home/website 8082
Now the static site will be available at
http://localhost:8082
If you have a Single Page Application (SPA) like Angular, React, you can use the option –spa with pm2 command so all non-existent pages get routed to index.html internally.
pm2 serve --spa