How to use proxy to host a new site with PM2 and Apache?
Sep 23, 2022
PM2 is a node hosting tool, you can host your side by using eg
pm2 start --name app-name npm -- start
It will start 3000 port by default, you could use PM2 to host production version too (please checkout PM2 website for more detail).
If your server is managed by Apache, you could create a website.com.config file with following code:
<VirtualHost *:80>ServerName www.website.comServerAlias website.comProxyPass / http://123.123.123.123:3000/ErrorLog /var/www/website.com/error.logCustomLog /var/www/website.com/requests.log combined</VirtualHost>
Once you restart your Apache server, the config will apply.
sudo apachectl restart