← TutorialsEC2 Hosting

Deploy a Node.js App on EC2

Install Node.js, deploy your app, and run with PM2.

12 min

Deploy a Node.js application on your Feed Forge EC2 instance.

Steps

  1. SSH into your EC2 instance.
  2. Install Node.js 20 LTS.
  3. Clone or upload your project.
  4. Install dependencies and start with PM2.

Code examples

# Install Node.js 20
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

# Deploy app
cd /var/www/myapp
npm install
npm install -g pm2
pm2 start app.js --name myapp
pm2 save && pm2 startup