Create a Let's Encrypt wildcard certificate

Create a Let’s Encrypt wildcard certificate

sudo dnf -y install certbot
sudo certbot certonly --manual --preferred-challenges dns -d "*.domain.tld" -d domain.tld

Sample output

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name:

_acme-challenge.domain.tld.

with the following value:

[ hash_id ]

Before continuing, verify the TXT record has been deployed. Depending on the DNS
provider, this may take some time, from a few seconds to multiple minutes. You can
check if it has finished deploying with aid of online tools, such as the Google
Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.domain.tld.
Look for one or more bolded line(s) below the line ';ANSWER'. It should show the
value(s) you've just added.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Add a Namecheap TXT record

Wait for record to be propagated

dig TXT domain.tld
dig TXT domain.tld @short

or

https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.domain.tld

# /etc/nginx/conf.d/www.domain.tld.conf

server {
    listen 80;
    server_name www.domain.tld;

    return 301 https://$host$request_uri;
}

# HTTPS server block
server {
    listen 443 ssl;
    server_name www.domain.tld;

    ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem;

    ssl_protocols       TLSv1.2 TLSv1.3;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    location / {
        root /usr/share/nginx/html;
        index index.html index.htm;
    }
}