I’m setting up a homelab and deploying Forgejo with nginx as a reverse proxy on NixOS.
I’ve configured nginx to use ACME (Let’s Encrypt staging for development).
Forgejo runs and is reachable over HTTP, but HTTPS uses a self-signed cert so ACME fails to obtain a valid certificate.
Jan 22 19:56:06 zenzi acme-order-renew-git.home.domain.com-start[2633]: [git.home.domain.com] propagation: time limit exceeded: last error: authoritative nameservers: NS khalid.ns.cloudflare.com.:53 did not return the expected TX>
Jan 22 19:56:06 zenzi acme-order-renew-git.home.domain.com-start[2600]: + echo Failed to fetch certificates. This may mean your DNS records are set up incorrectly. Self-signed certs are in place and dependant services will still s>
Jan 22 19:56:06 zenzi acme-order-renew-git.home.domain.com-start[2600]: Failed to fetch certificates. This may mean your DNS records are set up incorrectly. Self-signed certs are in place and dependant services will still start.
Jan 22 19:56:06 zenzi acme-order-renew-git.home.domain.com-start[2600]: + exit 10
Jan 22 19:56:06 zenzi systemd[1]: acme-order-renew-git.home.domain.com.service: Main process exited, code=exited, status=10/n/a
Jan 22 19:56:06 zenzi systemd[1]: acme-order-renew-git.home.domain.com.service: Failed with result 'exit-code'.
Jan 22 19:56:06 zenzi systemd[1]: Failed to start Order (and renew) ACME certificate for git.home.domain.com.
TXT _acme-challenge records are created and visible in Cloudflare UI.
Cloudflare has a DNS-only A record for *.home.domain.com pointing to the machine IP.
Using a Cloudflare API token with these permissions: Zone.Zone READ, Zone.DNS READ, Zone.Zone Edit, Zone.DNS Edit.
Browser shows a self-signed cert (Common Name: minica root ca hash).
What am I missing?
Why does NixOS/nginx ACME DNS challenge not complete even though the TXT record is present in Cloudflare UI, and how can I fix it so Forgejo is served with a valid Let’s Encrypt certificate?
kilisei@zenzi:~/ > journalctl -If -u acme-order-renew-git.home.domain.com.service
Jan 27 14:03:53 zenzi acme-order-renew-git.home.domain.com-start[1802]: + lego --accept-tos --path . --email cloudflare@domain.com --dns cloudflare --dns.resolvers 1.1.1.1:53 --server https://acme-staging-v02.api.letsencrypt.org/directory --key-type ec256 -d git.home.domain.com run
Jan 27 14:03:54 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:54 [INFO] [git.home.domain.com] acme: Obtaining bundled SAN certificate
Jan 27 14:03:54 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:54 [INFO] [git.home.domain.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz/...
Jan 27 14:03:54 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:54 [INFO] [git.home.domain.com] acme: Could not find solver for: tls-alpn-01
Jan 27 14:03:54 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:54 [INFO] [git.home.domain.com] acme: Could not find solver for: http-01
Jan 27 14:03:54 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:54 [INFO] [git.home.domain.com] acme: use dns-01 solver
Jan 27 14:03:54 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:54 [INFO] [git.home.domain.com] acme: Preparing to solve DNS-01
Jan 27 14:03:56 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:56 [INFO] cloudflare: new record for git.home.domain.com, ID 9a2e91b21fb8557f54a723ba7f60b7da
Jan 27 14:03:56 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:56 [INFO] [git.home.domain.com] acme: Trying to solve DNS-01
Jan 27 14:03:56 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:56 [INFO] [git.home.domain.com] acme: Checking DNS record propagation. [nameservers=1.1.1.1:53]
Jan 27 14:03:58 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:58 [INFO] Wait for propagation [timeout: 2m0s, interval: 2s]
Jan 27 14:03:58 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:03:58 [INFO] [git.home.domain.com] acme: Waiting for DNS record propagation.
Jan 27 14:04:00 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:04:00 [INFO] [git.home.domain.com] acme: Waiting for DNS record propagation.
...
Jan 27 14:05:59 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:05:59 [INFO] [git.home.domain.com] acme: Cleaning DNS-01 challenge
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:06:00 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz/...
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1810]: 2026/01/27 14:06:00 Could not obtain certificates:
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1810]: error: one or more domains had a problem:
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1810]: [git.home.domain.com] propagation: time limit exceeded: last error: authoritative nameservers: NS khalid.ns.cloudflare.com.:53 did not return the expected TXT record [fqdn: _acme-challenge.git.home.kilisei.dev., value: 1mD2if6n33Prd6Le24hZwGakQEjc3w_6yDqK3_OgheE]:
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1802]: + echo Failed to fetch certificates. This may mean your DNS records are set up incorrectly. Self-signed certs are in place and dependant services will still start.
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1802]: Failed to fetch certificates. This may mean your DNS records are set up incorrectly. Self-signed certs are in place and dependant services will still start.
Jan 27 14:06:00 zenzi acme-order-renew-git.home.domain.com-start[1802]: + exit 10
Jan 27 14:06:00 zenzi systemd[1]: acme-order-renew-git.home.domain.com.service: Main process exited, code=exited, status=10/n/a
Jan 27 14:06:00 zenzi systemd[1]: acme-order-renew-git.home.domain.com.service: Failed with result 'exit-code'.
Jan 27 14:06:00 zenzi systemd[1]: Failed to start Order (and renew) ACME certificate for git.home.domain.com.
Jan 27 14:06:00 zenzi systemd[1]: acme-order-renew-git.home.domain.com.service: Consumed 232ms CPU time, 14.9M memory peak, 56K incoming IP traffic, 27.6K outgoing IP traffic.