This guide helps you set up a wildcard certificate (*.example.com
) in NGINX Proxy Manager (NPM) using Cloudflare DNS-01 challenge with a proper API token.
โ Prerequisites¶
- You are using NGINX Proxy Manager (installed on TrueNAS SCALE 24.10 via App Store or Docker).
- Your domain is managed in Cloudflare.
- You want to issue a wildcard cert like
*.something.com
.
1. ๐ Create a Cloudflare API Token¶
โ ๏ธ Do not use Global API Key โ this is a common mistake. Use a scoped API Token instead.
Steps:¶
-
Click on "Create Token"
-
Under "API Token Templates", select "Edit zone DNS"
-
On the next screen:
-
Permissions:
- Zone โ DNS โ Edit
-
Zone Resources:
-
Include โ All Zones (or specify the zone you want)
-
Click Continue to summary โ Click Create Token
-
Copy the token and store it somewhere safe.
2. ๐ Configure NGINX Proxy Manager with Cloudflare¶
-
Go to NPM Dashboard โ SSL Certificates โ Add SSL Certificate
-
Choose Let's Encrypt
-
Fill in the form:
-
Domain Names:
*.something.com
(replace with your actual domain) - Email Address: your email
-
DNS Challenge Provider: Cloudflare (dns-cloudflare)
-
Under Advanced:
-
Tick Use a DNS Challenge
-
Fill in:
- CF_API_EMAIL: (Not needed if youโre using token-based auth)
- CF_API_KEY: Paste your newly created API Token
If NPM is using the certbot DNS plugin for Cloudflare, it will read from a config file. See next step.
3. โ๏ธ Optional: Store Token in Configuration File (If Required)¶
If NGINX Proxy Manager (your app instance) uses a config file for DNS credentials:
- Create a file named
cloudflare.ini
:
dns_cloudflare_api_token = YOUR_API_TOKEN
- Secure it:
chmod 600 cloudflare.ini
- Update your NGINX Proxy Managerโs Docker or app config to reference this file if needed.
In some NPM configurations, simply entering the API token into the UI is sufficient.
4. โ Issue the Certificate¶
- Save the configuration.
- Click on "Save" and NPM will attempt to issue the certificate via DNS-01 challenge.
- You should see success logs like:
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/...
5. ๐ Apply the Certificate¶
Now that the wildcard certificate is issued:
- Go to Hosts โ Proxy Hosts
- Edit or add a new proxy host
-
Under the SSL tab:
-
Enable SSL
- Select your newly created wildcard cert from the dropdown
- Enable Force SSL and HTTP/2 support as needed
๐ซ Common Mistakes to Avoid¶
- โ Using Global API Key instead of creating a scoped API token
- โ Forgetting to include wildcard domain (
*.something.com
) in the cert - โ Not ticking the โDNS Challengeโ box in NPM when using Cloudflare
๐ Renewals¶
Wildcard certs issued by Let's Encrypt are valid for 90 days. NGINX Proxy Manager handles auto-renewal as long as your API token remains valid and permissions donโt change.
Let me know if you'd like a version of this saved to your internal wiki format or exported as a Markdown file.
Perfect โ here's the updated full documentation, now including your NGINX Proxy Manager instructions for completing the Let's Encrypt wildcard cert setup via Cloudflare DNS challenge:
๐ก๏ธ Wildcard SSL Certificate with Cloudflare for NGINX Proxy Manager (TrueNAS 24.10)¶
This guide shows how to issue a wildcard SSL certificate (*.yourdomain.com
) via Let's Encrypt using Cloudflare DNS challenge, and configure it in NGINX Proxy Manager (NPM) โ perfect for hosting multiple subdomains with one cert on your TrueNAS server.
โ Prerequisites¶
- TrueNAS SCALE 24.10 running NGINX Proxy Manager
- Your domain is managed by Cloudflare
- You want wildcard SSL:
*.something.com
1๏ธโฃ Create a Scoped API Token in Cloudflare¶
โ ๏ธ Do NOT use the "Global API Key" โ instead, create a token.
Steps:¶
-
Click Create Token
-
Use the Edit zone DNS template
-
On the next screen:
-
Permissions:
- Zone โ DNS โ Edit
-
Zone Resources:
-
Include โ All Zones (or select just your domain)
-
Click Continue to Summary, then Create Token
-
Copy the token โ youโll use this in NGINX Proxy Manager.
2๏ธโฃ Configure Wildcard Certificate in NGINX Proxy Manager¶
Steps:¶
-
Open your NGINX Proxy Manager UI
-
Go to SSL Certificates โ Add SSL Certificate
-
Select Let's Encrypt
-
Fill out the form:
-
Domain Name(s):
*.something.com
(replace with your actual domain) (You can addsomething.com
as a second line if you want it to cover both root and subdomains) -
Email Address: Your email address
-
Use a DNS Challenge: โ Check this box
-
DNS Provider: From the dropdown, choose Cloudflare
-
Scroll down to Credentials File Content โ you will see:
# Cloudflare API token
dns_cloudflare_api_token =
โ Paste the token you copied from Cloudflare after the =
sign.
-
Agree to the Terms of Service
-
Click Save
3๏ธโฃ Certificate Issuance & Use¶
If successful, NPM will:
- Call the Cloudflare DNS API to add a
_acme-challenge
TXT record - Wait for DNS propagation
- Issue the wildcard cert from Let's Encrypt
Once saved, the certificate will appear in your list of SSL certs.
4๏ธโฃ Apply the Wildcard Certificate to Your Proxy Hosts¶
-
Go to Proxy Hosts
-
Edit an existing host or create a new one (e.g.,
app.something.com
) -
Under the SSL tab:
-
Check Block Common Exploits
- Enable SSL
- Select your wildcard cert from the dropdown
-
Optionally enable Force SSL and HTTP/2 Support
-
Click Save
๐ง Tips & Notes¶
-
Your wildcard cert (
*.something.com
) will cover any subdomain:app.something.com
,media.something.com
, etc. -
For root domain
something.com
, either: -
Add it as a separate domain in the same cert request
-
Or create a second cert just for the root domain
-
NPM will auto-renew the cert before expiry if the API token remains valid.