Install nginx
1
2
3
sudo apt update
sudo apt upgrade -y
sudo apt install nginx -y
press ‘Enter’ if it prompts to restart some program.
Install certbot
I’m in Ubuntu 20.04, so I use snap to install certbot.
1
2
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
Run certbot
1
sudo certbot --nginx
follow the instructions it prompts you.
If you only enter one domain, and not add server block for it, it will create two new server blocks in your /etc/nginx/sites-enabled/default
file, one for port 80, one for port 443.
I will move these two server blocks to /etc/nginx/sites-enabled/yourdomain.com
and configure it.
Append new domains
1
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com