Posts

Showing posts from July, 2023

Deploying Node.js on Amazon EC2

Image
Node.js application deployment on EC2  :  1. Create an EC2 instance. 2. Connect to your EC2 instance ex: ssh -i <your-key.pem> ec2-user@<your-ec2-public-ip> Step 1:  Install NodeJS & NPM using nvm :   please run these command to deploy node js application --> 1.  sudo su - 2.  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash Activate NVM 3.  . ~/.nvm/nvm.sh   install node js latest version--> 4.   nvm install node Install Git : 5.   sudo apt-get update -y 6.   sudo apt-get install git -y Run below command to clone  repository from Github: :  7.  git clone https://github.com/vakilsingh12/file-uploadNode.git inside directory install package :  8 . cd  file-uploadNode 9.    npm install 10.  npm start Run Node App as Background Service Using PM2 Run following command to run app as background :  11.   sudo npm install -g pm2 12. sudo pm2 install pm2-logrotate 13. sudo pm2 start app.js --name node-app check status of the application usi