Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PM2

install

Ubuntu 22 ARM

1

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source .bashrc
nvm install --lts
nvm use --lts
npm install -g pm2
pm2 dump
pm2 startup
# pm2 unstartup

Configuare Apache

2 3

Rocky Linux

pm2 start npm --name "<app_name>" --watch -- start

Create a new VirtualHost configuration with subdomain names:

sudo vim /etc/httpd/conf.d/sub.domain.com.conf
<VirtualHost *:80>
  ServerName www.sub.domain.com
  ServerAlias sub.domain.com

  ErrorLog /var/log/httpd/sub.domain.com-error.log
  CustomLog /var/log/httpd/sub.domain.com-access.log combined
  ProxyPreserveHost On
  ProxyPass / http://localhost:3000/
  ProxyPassReverse / http://localhost:3000/
</VirtualHost>

reference

cross-reference


  1. Persistent applications

  2. How to specify a port number for pm2

  3. How to change the port in nextjs?