Skip to content

Instantly share code, notes, and snippets.

@koobitor
Last active May 13, 2020 15:19
Show Gist options
  • Save koobitor/05ad1a1b1a593afa53b244c01ddf9eae to your computer and use it in GitHub Desktop.
Save koobitor/05ad1a1b1a593afa53b244c01ddf9eae to your computer and use it in GitHub Desktop.

Step 1 – Installing Nginx

apt update
apt install -y nginx

Step 2 – Adjusting the Firewall

ufw app list
ufw allow 'Nginx Full'
ufw allow 'OpenSSH'
ufw enable
ufw status

Step 3 – Checking your Web Server

systemctl status nginx

Install NVM

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash

export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

pm2

npm install -g pm2

SSH Key Gen

ssh-keygen -t rsa -b 4096 -C "koobitor@gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub

git config --global user.name "Sakol Assawasagool"
git config --global user.email koobitor@gmail.com

Nginx New Site

touch /etc/nginx/sites-enabled/api.line.re

api.line.re content

server {
    listen 80;
    server_name api.line.re;

    location / {
        proxy_pass http://127.0.0.1:3000;
        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;
     }
}

Reload Nginx Config

/etc/init.d/nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment