AWS: connect EC2
- Run Git Bash as administrator
- Connect EC2 ` $ ssh ec2-user@public-ip-address -i ec2keypair.pem`
- Remove old directory
$ rm -rf xx
- Clone new repository:
git clone https://github.com/LiMarcus/myWeb.git
npm install -g pm2
- check current status:
pm2 list
- kill all process
pm2 kill
- remove
npm remove pm2 -g
pm2 start app.js
pm2 save
pm2 startup
- Nginx
My front end send https request to EC2 balancer, the balancer has a function to convert https to http then send to instance, after that, I use Nginx to redirect http request to port 8888;
Actually, Nginx can handle https request, we can set SSL in Nginx; But I choose using AWS certificate, the disadvatange is this certificate can only deploy on EC2 balancer, then use balancer send requset to each instance;
sudo nano /etc/nginx/nginx.conf
load balancer