How to run pm2 for Angular SSR in AWS EC2 ?

1. Do git clone and take the angular universal configured project to your aws ec2.
2. Go to the folder, cd /ngdev-ssr-master/
cd /ngdeveloper (this is my project name)
3. sudo npm run build:ssr [which internally does and creates the /server/main.js file by doing ng build –prod]
You cna run npm run serve:ssr to check whether this runs properly, if it is successful then you can use the pm2 to run the stuffs at the background.
4. pm2 kill (kill if any existing pm2 is running) [Refer this tutorial to learn how more about pm2 ]
5. pm2 start dist/ngdeveloper/server/main.js (make sure you have this file, if any name changes run accrodingly).

Leave a Reply