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
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"
npm install -g pm2
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
touch /etc/nginx/sites-enabled/api.line.re
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;
}
}
/etc/init.d/nginx reload