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, put your files inside.

Let’s create a static file, say index.html

Now you can make the site live using the following pm2 command

Now the static site will be available at

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.

Leave a Reply

Your email address will not be published. Required fields are marked *