1. Install nginx

sudo apt install nginx

  1. Install certbot

sudo apt install certbot python3-certbot-nginx

  1. Configuring nginx

sudo ufw app list

The command will list available profiles. If https is not allowed, use the following command

ufw allow Nginx HTTPS

Check status

sudo ufw status

  1. Make sure that nginx is running

systemctl status nginx

  1. Setup hosting
cd /var/www
mkdir your-site.com

cd /etc/cd /etc/nginx/sites-available/

cp default your-site.com

edit config

nano your-site.com

server_name your-site.com www.your-site.com

enable site on nginx

sudo ln -s /etc/nginx/sites-available/your-site.com etc/nginx/sites-enabled/

test config

sudo nginx -t

restart nginx

sudo systemctl restart nginx

obtain ssl certificate

sudo certbot --nginx -d your-site.com -d www.your-site.com

restart nginx

sudo systemctl restart nginx