- Deploy Ubuntu 20.04 server
- Deployment of MySQL Express React Node.JS
- Enable port 8080 for webserver on Security Groups
- Deploy DB server first and make new user Set DB = posts and table = posts
sudo -i
apt clean all && sudo apt update && sudo apt dist-upgrade -y
apt install -y nginx
rm -rf /var/www/*
rm /etc/nginx/sites-available/default
rm /etc/nginx/sites-enabled/default
nano /etc/nginx/sites-available/netflix
Use public ip of web server
server {
listen 80;
location / {
root /var/www/netflix/client;
index index.html index.htm;
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;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://172.31.89.26:8080;
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;
}
}
ln -s /etc/nginx/sites-available/netflix /etc/nginx/sites-enabled/netflix
mkdir /var/www/netflix
mkdir /var/www/netflix/client
systemctl start nginx
apt install git
mkdir netflix
cd netflix
git clone https://github.com/GuillenDiego/form_app-2.0.git
cd ~/netflix/form_app-2.0/backend
nano .env
This goes in .env
PORT = 8080
# Database credentials
DB_USERNAME= admin
DB_PASSWORD= password
DB_DATABASE= posts
DB_HOST= database-1.c5q6kqir4w0q.us-east-1.rds.amazonaws.com
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 16.15.0
npm i
cd ../client
nano .env
Use public ip of web server
REACT_APP_API_URL = "http://172.31.89.26:8080/"
start or restart nginx
npm i
npm run build
rm -rf /var/www/netflix/client/*
cp -r build/* /var/www/netflix/client
systemctl start nginx
cd ~/netflix/form_app-2.0/backend
node index.js