NGINX: Reverse Proxy
This tutorial about using NGINX reverse proxy.
NGINX Installation
sudo apt update
sudo apt install nginx -yCheck for NGINX status
sudo systemctl status nginxNGINX Configuration
Create configuration files on /etc/nginx/sites-available/. Change example.com to your domain.
sudo nano /etc/nginx/sites-available/example.comAdd this configurations. Change example.com and http://localhost:3000 to your use port.
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Activate this using symlink to sites-enabled directory.
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/Last, check if conf OK then reload NGINX.
sudo nginx -t
sudo systemctl reload nginxLast updated