Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate wildcard HTTPS certificates with certbot

How do I generate wildcard HTTPS certificates?

server {
    server_name subdomain.domain.com www.subdomain.domain.com *.subdomain.domain.com  ~^(.*)\.subdomain\.domain\.com$;
}

Currently, for normal domains, I generate certificates like this:

sudo certbot --nginx -d example.com
like image 730
Rafael Augusto Avatar asked Jul 05 '26 19:07

Rafael Augusto


2 Answers

I used following to generate wildcard certificate and it worked like charm. Here we are doing dns challenge hence you should have access to your dns to make entries that will be read while create certificate.

sudo certbot certonly --manual   -d *.example.com   -d example.com \ 
--email [email protected]   --agree-tos \ 
--preferred-challenges dns-01 \ 
--server https://acme-v02.api.letsencrypt.org/directory

Hope this information will help you

like image 121
Abhijit Avatar answered Jul 09 '26 02:07

Abhijit


For wildcard just add another entry with *

sudo certbot --nginx -d *.example.com -d example.com

You can further refer here Let's Encrypt: Wildcard Certificate With Certbot

like image 22
Abhishek Jebaraj Avatar answered Jul 09 '26 00:07

Abhishek Jebaraj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!