Adding Custom Domain Names on Your Internal Network Using Nginx Proxy Manager and Pi-Hole
Blog How I set up custom domain names on my internal network with Pi-Hole for DNS and Nginx Proxy Manager, plus what works for SSL on local-only domains.
- : Step 3 told you to get a Let’s Encrypt certificate for
magic.mirror. Let’s Encrypt only signs real public domains, so that couldn’t work. Step 3 now uses a DNS-01 wildcard on a domain you own, or mkcert.
TL;DR I got tired of typing IP addresses, so I set up Pi-hole for local DNS and Nginx Proxy Manager for routing. Let’s Encrypt won’t sign a made-up name like magic.mirror, so for HTTPS use a DNS-01 wildcard cert on a domain you own, or mkcert if you don’t. DNS and routing take about 15 minutes.
On this page
Update (September 2026): A reader pointed out that my original SSL steps couldn’t work, and they’re right. I’ve rewritten Step 3; Steps 1 and 2 are unchanged.
I got tired of typing IP addresses to access services on my homelab, so I set up custom domain names on my internal network. If you don’t have a homelab yet, check out my guide on how to get started building a homelab server
Sep 27, 2023How to get started building a Homelab server in 2027 first. I use Pi-hole for local DNS and Nginx Proxy Manager to route requests and handle certificates.
Pi-hole is best known for ad blocking, but it’s also a local DNS server. To set a custom domain:
- Log into the Pi-hole admin page.
- Go to Settings > Local DNS Records.
- 1 Jul 2024ICANN reserved .internal for private networks on July 29, 2024. It will never be delegated on the public internet, so a name like magic.internal is safe from future collisions.Enter your custom domain (such as
magic.mirror) and the IP address of your Nginx Proxy Manager server. The domain doesn’t need to be registered or use a real top-level domain1 (TLD), but Let’s Encrypt won’t issue a certificate for it (see Step 3).1 Jul 2024ICANN reserved .internal for private networks on July 29, 2024. It will never be delegated on the public internet, so a name like magic.internal is safe from future collisions.
Next, I configured Nginx Proxy Manager to forward requests for the custom domain:
- Open the Nginx Proxy Manager admin interface.
- Go to Proxy Hosts, click Add Proxy Host, and enter the custom domain you set in Pi-hole (such as
magic.mirror). - 2Under Forward Hostname / IP, enter the IP address of the server running the service (such as your MagicMirror server), and its port (MagicMirror defaults to 80802).
How to Build A Spotify Player with React in 15 MinutesI built a MagicMirror of my own and wrote a Spotify player for it in another post. - Optionally, turn on Cache Assets for speed and Block Common Exploits for security.
Let’s Encrypt can’t issue a certificate for a made-up TLD like .mirror - it validates against the public suffix list, and magic.mirror isn’t on it. You’ll get a hard error before any challenge is even attempted. Skipping the reachability test doesn’t fix this.
There are two real approaches depending on whether you own a public domain:
This challenge asks you to prove that you control the DNS for your domain name by putting a specific value in a TXT record under that domain name.Let's Encrypt, Challenge Types
If you have a real domain - even a cheap one - this is the cleanest path. Get a wildcard Let’s Encrypt cert for something like *.home.yourdomain.com using the DNS-01 challenge3, then use Pi-hole to point those subdomains at your local NPM. Traffic stays on your LAN, but browsers trust the cert.
This challenge asks you to prove that you control the DNS for your domain name by putting a specific value in a TXT record under that domain name.Let's Encrypt, Challenge Types
- In NPM, when adding SSL to a host, choose “Let’s Encrypt” and switch the challenge to DNS
- Choose your DNS provider - Cloudflare is the easiest since NPM has built-in support. You’ll need a Cloudflare API token with
Zone:DNS:Editpermission - Request a wildcard cert for
*.home.yourdomain.com- NPM creates a TXT record via the API to prove ownership, Let’s Encrypt validates it, cert issued - In Pi-hole, add local DNS records pointing
service.home.yourdomain.comto your NPM IP - Your browser hits
magic.home.yourdomain.com, Pi-hole resolves it locally, NPM serves it with a valid cert
The cert renewal is automatic and nothing on your network needs to be publicly reachable.
mkcert is a simple tool for making locally-trusted development certificates. It requires no configuration.mkcert's README
Use mkcert. It creates a local certificate authority and signs certs for whatever hostnames you want4, including magic.mirror or any other local invention.
mkcert is a simple tool for making locally-trusted development certificates. It requires no configuration.mkcert's README
brew install mkcert
mkcert -install # installs the CA into your OS trust store
mkcert magic.mirror # generates a cert + key for that hostname
In NPM, go to Certificates > Add Certificate > Custom Certificate and upload magic.mirror.pem and magic.mirror-key.pem, then choose that certificate in the proxy host’s SSL settings.
You need to install the CA certificate on every device that needs to trust it - each phone, tablet, laptop. For a one-person homelab that’s a one-time thing; for a household it gets annoying fast.
For most homelab setups I’d go with Option A if you have any public domain at hand. The DNS-01 approach with NPM and Cloudflare takes about 10 minutes once you have the API token, and you never have to touch trust stores again.
Reference Links:
Works on My Machine
Get the next post by email. My newsletter covers homelab builds, AI tools and open source, and it goes out when I have something to say.
It’s free, and you can unsubscribe anytime. You’ll get an email to confirm first.
If you liked this post, consider sharing it on Hacker News, Bluesky, LinkedIn, or X.

Joe
Karlsson
Technology is better when it's weird and it's yours. Everything I write about runs in my house.
More about me →