Real quick and simple certbot commands to create a certificate only for a new domain/subdomain.
Then install and update your preconfigured nginx config for said domain with the newly created certs.
Prerequisites
- Nginx configured for your target domain eg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # /etc/nginx/sites-enabled/example.com server { root /var/www/example.com/public; index index.php index.html index.htm; server_name example.com www.example.com; location ~ /.well-known { allow all; } location ~ /\.ht { deny all; } listen 443 ssl; listen 80; } |
Creating and Installing New Certificates
1 2 3 4 5 6 7 8 | # For additional domains to be covered by the same cert you can append with -d <another.com> $ sudo certbot certonly --cert-name sub01.example.com -d sub01.example.com # List existing certs $ sudo certbot certificates # Configure certs for nginx $ sudo certbot --nginx |