Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

A Let's Encrypt certificate did not renew with Certbot

ErrorCertbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:

Short answer

Run sudo certbot renew --dry-run and read the Type and Detail lines. They say whether Let's Encrypt could not connect (port 80 or a firewall), fetched the wrong file (webroot or redirect) or reached the wrong server (DNS). If the dry run passes, the scheduled timer is not running or nginx was never reloaded after the last renewal.

  • Applies to Certbot 5, nginx 1.28, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run a test renewal. It talks to the Let's Encrypt staging server, so it does not use up production limits, and it prints the exact reason for each domain.

    sudo certbot renew --dry-run
  2. 2Match what you see, then jump to its fix

    1. 1Type: connection, Timeout during connect (likely firewall problem)Port 80 is closed to the internetFix
    2. 2Type: unauthorized, Invalid response from .../.well-known/acme-challenge/...: 404, 403, or your app's HTMLThe challenge file is served from another folder, or a rule catches the pathFix
    3. 3Invalid response from an IP address that is not yours, or DNS problem: NXDOMAIN looking up A for example.comDNS sends the name to another serverFix
    4. 4Could not bind TCP port 80 because it is already in use by another process on this systemThe certificate was issued with --standalone, and nginx now holds port 80Fix
    5. 5No recent entries in /var/log/letsencrypt/letsencrypt.log, or certbot certificates shows a new expiry date while browsers still see the old oneRenewal never runs, or nginx keeps serving the old certificateFix
    6. 6The error type is rateLimited and the message names a time to retry afterRepeated failed attempts hit a rate limitFix

What does the error look like?

  • Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
  • Type: connection ... Timeout during connect (likely firewall problem)
  • Type: unauthorized ... Invalid response from http://example.com/.well-known/acme-challenge/...: 404
  • Could not bind TCP port 80 because it is already in use by another process on this system (such as a web server).
  • All renewals failed. The following certificates could not be renewed:

Cause 1 of 6

Port 80 is closed to the internet

1Check

HTTP-01 validation always arrives on port 80, even for a site that runs only on HTTPS. Check the server's firewall and the cloud provider's firewall or security group, then request a challenge URL from a machine outside your network.

sudo ufw status | grep -E '^80|Nginx'
curl -sI -m 10 http://example.com/.well-known/acme-challenge/test

2Fix

Open port 80 and leave it open. Normal visitors can still be redirected to HTTPS; only the challenge path has to answer over plain HTTP or redirect to HTTPS on port 443.

sudo ufw allow 80/tcp

3Verify

From outside, the test URL now returns an HTTP status line (a 404 is fine) instead of hanging.

curl -sI -m 10 http://example.com/.well-known/acme-challenge/test | head -n 1
Did this fix it?

Cause 2 of 6

The challenge file is served from another folder, or a rule catches the path

1Check

With the webroot plugin, Certbot writes the challenge file under the folder saved in the certificate's renewal file. If the site moved, or the port 80 server block hands every path to the app or puts it behind a password, Let's Encrypt fetches the wrong answer. Compare the saved folder with what nginx serves.

sudo grep -E 'authenticator|webroot' /etc/letsencrypt/renewal/example.com.conf
sudo nginx -T 2>/dev/null | grep -n -A3 'acme-challenge\|listen 80'

2Fix

Give the challenge path its own fixed folder in the port 80 server block, ahead of the HTTPS redirect, then save that folder in the renewal settings with certbot reconfigure (Certbot 2.3 and later). Reconfigure runs a test renewal before it saves anything.

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    location ^~ /.well-known/acme-challenge/ {
        root /var/www/letsencrypt;
        default_type text/plain;
    }
    location / {
        return 301 https://$host$request_uri;
    }
}

sudo mkdir -p /var/www/letsencrypt/.well-known/acme-challenge
sudo nginx -t && sudo systemctl reload nginx
sudo certbot reconfigure --cert-name example.com --webroot --webroot-path /var/www/letsencrypt

3Verify

Drop a test file in the folder and fetch it over plain HTTP.

echo ok | sudo tee /var/www/letsencrypt/.well-known/acme-challenge/ping
curl -s http://example.com/.well-known/acme-challenge/ping
Did this fix it?

Cause 3 of 6

DNS sends the name to another server

1Check

When a name has both A and AAAA records, Let's Encrypt connects over IPv6 first and falls back to IPv4 only if that connection times out. An AAAA record left over from an old server, or a CDN proxy that was switched on, sends validation somewhere else. Compare every record with this server's own addresses.

dig +short A example.com
dig +short AAAA example.com
ip -br addr show scope global

2Fix

Correct or delete the wrong record at your DNS provider. If nginx should answer on IPv6, make it listen there; if the server has no IPv6, remove the AAAA record rather than leave it pointing at nothing.

# nginx, in the port 80 server block
listen [::]:80;

# after the DNS change, ask a public resolver
dig +short AAAA example.com @1.1.1.1

3Verify

Once the old record's TTL has passed, run the test renewal for this certificate only.

sudo certbot renew --dry-run --cert-name example.com
Did this fix it?

Cause 4 of 6

The certificate was issued with --standalone, and nginx now holds port 80

1Check

The standalone plugin starts its own short-lived web server on port 80. That worked at first issue, before nginx was installed; every renewal since then collides with nginx. The renewal file shows which plugin was saved.

sudo grep -H authenticator /etc/letsencrypt/renewal/*.conf

2Fix

Switch the saved method to one that works next to nginx: the nginx plugin, which also reloads nginx after each renewal, or webroot with the location block from the cause above.

sudo certbot reconfigure --cert-name example.com --authenticator nginx --installer nginx

3Verify

The renewal file now names nginx, and a test renewal passes while nginx keeps running.

sudo grep -E 'authenticator|installer' /etc/letsencrypt/renewal/example.com.conf
sudo certbot renew --dry-run --cert-name example.com
Did this fix it?

Cause 5 of 6

Renewal never runs, or nginx keeps serving the old certificate

1Check

Certbot from apt is scheduled by certbot.timer and the snap by snap.certbot.renew.timer. If neither is listed, nothing renews. If renewal did run, compare the expiry on disk with the one nginx serves: nginx only loads a new certificate on reload.

systemctl list-timers | grep -i certbot
sudo certbot certificates | grep -E 'Certificate Name|Expiry'
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -enddate

2Fix

Enable the timer, and add a deploy hook so nginx reloads whenever a certificate actually changes. Executables in the deploy hooks folder run only after a successful renewal.

sudo systemctl enable --now certbot.timer   # snap: snap.certbot.renew.timer

sudo tee /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh >/dev/null <<'EOF'
#!/bin/sh
systemctl reload nginx
EOF
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh

3Verify

The timer has a next run time, and after the next renewal the served expiry date matches the file on disk.

systemctl status certbot.timer --no-pager
Did this fix it?

Cause 6 of 6

Repeated failed attempts hit a rate limit

1Check

Let's Encrypt allows 5 failed validations per domain per account per hour, and 5 certificates for the exact same set of names every 7 days. A cron line that forces renewal, or a script that retries in a loop, reaches these quickly. Renewals scheduled through ACME Renewal Information (ARI, supported since Certbot 4.1) are exempt from every limit.

sudo grep -i "ratelimited" /var/log/letsencrypt/letsencrypt.log | tail -n 3
sudo grep -R "force-renew" /etc/cron* /etc/systemd/system 2>/dev/null

2Fix

Stop retrying against production. Remove any forced renewal from cron, fix the cause with --dry-run (staging has separate limits), wait until the retry time in the error, then run one real renewal.

sudo certbot renew --dry-run --cert-name example.com
# after the retry time has passed:
sudo certbot renew --cert-name example.com

3Verify

The certificate shows a new expiry date about the full lifetime ahead.

sudo certbot certificates --cert-name example.com
Did this fix it?

How do I stop it coming back?

  • Monitor expiry from outside the server: Let's Encrypt stopped sending expiry emails on 4 June 2025, so nothing warns you unless you set it up.
  • Keep port 80 open with a fixed challenge location in every site, including those that send everything else to HTTPS.
  • Run sudo certbot renew --dry-run after any change to DNS, the firewall or nginx.
  • Keep Certbot current and let it decide when to renew. Let's Encrypt moves its default certificates to 64 days on 10 February 2027 and 45 days on 16 February 2028, so a fixed hand-made schedule will break.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.