-
npm install pm2 -g
-
brew install nginx
-
cd /usr/local/etc/nginx
-
add server config below to nginx.conf
-
cd /var mkdir www
-
cd /var/www sudo chmod -R 777 /var/www
-
npm install in client and server
-
cd client npm run build
-
pm2 start
-
brew services restart nginx
-
to change update the ssh
-
cd .ssh
-
ssh -i "Reminder AMI.pem" ec2-user@ec2-54-202-116-108.us-west-2.compute.amazonaws.com
-
if code is changed pull changes from git reop in ssh
-
pm2 kill
-
pm2 start
-
sudo service nginx restart
-
npm run build in client
-
pm2 save
-
pm2 startup
Commands:
pm2 stop all - kills pm2 sudo nginx -s stop brew services start nigx
Nginx Conf:
server { listen 80 default_server; listen [::]:80 default_server; server_name localhost; root /var/www/build; index index.html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://localhost:4000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}