brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Use DNS Challenge in Nginx Proxy Manager gets you one wildcard certificate

Nginx Proxy Manager
~/tips/tip-nginxproxymanager-dns-challenge-wildcard

dns_cloudflare_api_token=0123456789abcdef0123456789abcdef01234567

Gets one wildcard certificate for all your subdomains in Nginx Proxy Manager without opening port 80.

By default Nginx Proxy Manager proves to Let’s Encrypt that you own a domain over port 80, one certificate per proxy host. That works, but it means port 80 has to be reachable from the internet, and every new subdomain is another request. The DNS challenge skips both.

With a DNS challenge, certbot proves ownership by placing a TXT record in your DNS through your provider’s API. Let’s Encrypt only hands out wildcard certificates this way, and a wildcard is the nice part: one certificate for *.example.com that every proxy host can use.

In NPM, go to SSL Certificates and add a Let’s Encrypt certificate. Enter both names, *.example.com and example.com, since the wildcard doesn’t cover the bare domain. Switch on Use DNS Challenge, pick your provider, and paste its credentials in the box. For Cloudflare that is one line:

dns_cloudflare_api_token=0123456789abcdef0123456789abcdef01234567

NPM installs the matching certbot plugin by itself when you request the certificate. After that, each new proxy host just picks the existing wildcard on its SSL tab, and nothing new is requested. For a Dutch domain it’s worth checking the provider list: TransIP is in there, for example, though its plugin wants a key file instead of a token.

Mind the credentials, though. NPM warns that this data is stored as plaintext in its database and in a file, so anyone with your NPM data folder or a backup of it has that key. For Cloudflare I’d make an API token with only Zone:DNS:Edit on the one zone, which is what the certbot plugin docs recommend, never the Global API Key. And stick to one DNS provider per NPM instance if you can: the NPM docs warn that plugins of different providers can clash on their Python dependencies. If a request fails, the NPM container log is where certbot shows why.

Further reading: Nginx Proxy Manager: Certbot DNS plugins, certbot-dns-cloudflare documentation, Let's Encrypt: Challenge types

Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get

More Nginx Proxy Manager tips /data/nginx/custom/server_redirect.conf Strict-Transport-Security: max-age=63072000; preload allow 192.0.2.0/24; docker compose restart npm services: All Nginx Proxy Manager tips (32) All topics

Link