My platform: macOS + macports
Install certbot
sudo port install certbot
Write a shell script
make_cert.sh
#!/bin/sh
set -e
sudo certbot --duplicate certonly -d "*.$1" -d "$1" --manual --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
Usage
make_cert.sh domain.com
Configure nginx
Copy all certs to /etc/nginx/cert
On Ubuntu
vim /etc/nginx/sites-available/default
Enable ssl configuration
ssl on;
ssl_certificate /etc/nginx/cert/fullchain.pem;
ssl_certificate_key /etc/nginx/cert/privkey.pem;