Skip to content

(Updated ) 4 min read Homelab

Adding Custom Domain Names on Your Internal Network Using Nginx Proxy Manager and Pi-Hole

Postal workers sorting a cart of mail sacks

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.

Corrections
  • : 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
  1. Step 1: Add a local DNS record in Pi-hole
  2. Step 2: Add a proxy host in Nginx Proxy Manager
  3. Step 3: HTTPS certificates

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 serverSep 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.

BROWSER magic.mirror PI-HOLE local DNS record where is magic.mirror? back: NPM’s IP NGINX PROXY MANAGER proxy host the request for magic.mirror MAGIC MIRROR the service’s own IP Forward Hostname / IP
PI-HOLE local DNS record where is magic.mirror? back: NPM’s IP BROWSER magic.mirror request for magic.mirror NGINX PROXY MANAGER proxy host Forward Hostname / IP MAGIC MIRROR the service’s own IP

Step 1: Add a local DNS record in Pi-hole

Pi-hole is best known for ad blocking, but it’s also a local DNS server. To set a custom domain:

  1. Log into the Pi-hole admin page.
  2. Go to Settings > Local DNS Records.
  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.
    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.

Step 2: Add a proxy host in Nginx Proxy Manager

Next, I configured Nginx Proxy Manager to forward requests for the custom domain:

  1. Open the Nginx Proxy Manager admin interface.
  2. Go to Proxy Hosts, click Add Proxy Host, and enter the custom domain you set in Pi-hole (such as magic.mirror).
  3. Under 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).
  4. Optionally, turn on Cache Assets for speed and Block Common Exploits for security.

Step 3: HTTPS certificates

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:

YOU OWN A DOMAIN NO PUBLIC DOMAIN NGINX PROXY MANAGER API token adds a TXT record CLOUDFLARE DNS DNS-01 challenge LET’S ENCRYPT issues *.home.yourdomain.com trusted everywhere, renews itself mkcert -install creates LOCAL CA in your trust store mkcert magic.mirror magic.mirror cert + key and the CA goes on EVERY PHONE AND LAPTOP installed by hand Let’s Encrypt won’t sign magic.mirror: .mirror isn’t a public suffix
YOU OWN A DOMAIN NO PUBLIC DOMAIN NGINX PROXY MANAGER API token adds a TXT record CLOUDFLARE DNS DNS-01 challenge LET’S ENCRYPT issues *.home.yourdomain.com trusted everywhere, renews itself Let’s Encrypt won’t sign magic.mirror: .mirror isn’t a public suffix mkcert -install creates LOCAL CA in your trust store mkcert magic.mirror magic.mirror cert + key and the CA goes on EVERY PHONE AND LAPTOP installed by hand
3 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.

3 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:Edit permission
  • 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.com to 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.

Option B: No public domain at all

4 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.

4 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 at his desk, chin on hand, with a microphone in front of him

Joe
Karlsson

Technology is better when it's weird and it's yours. Everything I write about runs in my house.

More about me →

BlueskyLinkedInGitHub