5 steps to switch your Express website from AWS to Oracle Cloud

DISCLAIMER: We love AWS, still have services running there and we don’t exclude some day we’ll be back, but for the time being…

Step 0 — Create your instance

Step 1— Install Node.JS

sudo apt update
sudo apt upgrade
sudo apt install nodejs
nodejs -v
sudo apt install npm
npm install
sudo npm install pm2@latest -g
pm2 start OUR-APP.js --name website 
curl http://localhost:APP-PORT
pm2 status
pm2 info website

Step 2— Install nginx

sudo apt install nginx
sudo systemctl status nginx
sudo iptables -I INPUT -p tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPTsudo iptables -I OUTPUT -p tcp --sport 80 -m conntrack --ctstate ESTABLISHED -j ACCEPT

Step 3 — Update DNS

Step 4 — Server blocks and Certificates

sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www/example.com
sudo nano /etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;

root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com; location / {
proxy_pass http://localhost:APP-PORT;
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;
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nano /etc/nginx/nginx.conf
sudo nginx -t
sudo systemctl restart nginx
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo certbot  — nginx -d example.com — Congratulations! Your certificate and chain have been saved at:
Your key file has been saved at:
Your cert will expire on 2021–04–16. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the “certonly” option. To non-interactively renew *all* of
your certificates, run “certbot renew”
sudo iptables -I INPUT -p tcp  — dport 443 -m conntrack  — ctstate NEW,ESTABLISHED -j ACCEPTsudo iptables -I OUTPUT -p tcp  — sport 443 -m conntrack  — ctstate ESTABLISHED -j ACCEPT

Our Mission at Manent.AI is to provide companies with actionable knowledge about what customers are saying in online reviews.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store