Apply for Free VPS

Get a certificate with a DNS challenge

Updated 27 Nov 2026 https certbot dns

Issue a Let's Encrypt certificate without ports 80 or 443.

A DNS-01 challenge proves you control a domain by creating a DNS record, so nothing needs to reach your server.

Automatic with your DNS provider

Certbot has plugins for several providers. With Cloudflare:

sudo apt install -y certbot python3-certbot-dns-cloudflare
sudo install -m 600 /dev/null /root/cloudflare.ini
sudo nano /root/cloudflare.ini

Contents, using a token limited to editing DNS for that one zone:

dns_cloudflare_api_token = YOUR_TOKEN
sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/cloudflare.ini -d app.example.com

Manual

sudo certbot certonly --manual --preferred-challenges dns -d app.example.com

Create the TXT record shown, wait until dig +short TXT _acme-challenge.app.example.com returns it, then continue. Manual certificates do not renew by themselves.

Use it on a forwarded port

server {
    listen 20002 ssl;
    server_name app.example.com;
    ssl_certificate     /etc/letsencrypt/live/app.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;
    root /var/www/app;
}

Visitors use https://app.example.com:20002. Reload Nginx after renewals.

Was this helpful?

Report outdated or incorrect information