- click connect on dashboard and go SSH client copy 3 and 4 information
- go local terminal paste information as below
- chmod 400 <keyname.pem>
- from SSH client bullet 3
- make sure you are on key directory to run command
- ssh -i <"keyname.pem" [email protected]>
- from SSH client Example
- chmod 400 <keyname.pem>
- sudo apt update
- sudo apt install nodejs npm nginx git -y
- nodejs -v
- curl -sL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh
- sudo bash nodesource_setup.sh
- sudo apt install nodejs -y node -v
- sudo apt install build-essential
- git clone https://github.com/your_github_username/MERN-Deployment.git
- export repoName=MERN-Deployment
- echo MERN-Deployment
- cd ~/MERN-Deployment/client
- sudo rm -rf /var/www/html
- sudo mv build /var/www/html
- sudo service nginx restart
- fix fronend route start with /
- sudo grep -rl localhost /var/www/html | xargs sed -i 's/http://localhost:8000//g'
- cd ~/MERN-Deployment/server
- npm i
- wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
- echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
- sudo apt update
- sudo apt install -y mongodb-org
- sudo service mongod start
- service mongod status
- sudo rm /etc/nginx/sites-available/default
- sudo vim /etc/nginx/sites-available/default
- import the code below in lines
- MERN-Deployment Configuration 1-16-2020
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name MERN-Deployment;
location /api {
proxy_pass http://localhost:8000;
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;
} location / { try_files $uri $uri/ =404; } error_page 404 /index.html; }
- MERN-Deployment Configuration 1-16-2020
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name MERN-Deployment;
location /api {
proxy_pass http://localhost:8000;
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;
- import the code below in lines