- go to "/etc/nginx/sites-available"
- create a new file (with sudo)
- copy this
server {
server_name SUBDOMAIN_URL;
location / {
proxy_pass NODE_APP;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- create new symlink
sudo ln -s /etc/nginx/sites-available/prod /etc/nginx/sites-enabled/
- create HTTPS certificate
sudo certbot --nginx -d SUBDOMAIN_URL
- restart nginx
sudo systemctl restart nginx
*- renew certficates
certbot renew