What HTTPS does in Pi-hole and why you might want it
HTTPS encrypts the connection between your browser and Pi-hole's admin dashboard, so anyone on your network cannot see your login credentials or the DNS queries you're viewing in real time. Without HTTPS, that traffic travels in plain text.
Pi-hole runs an HTTP web interface by default on port 80. If you access the dashboard from outside your home network — or if you share your network with people you don't fully trust — HTTPS adds a meaningful layer of protection. The trade-off is that you'll see a browser warning about an untrusted certificate unless you install a proper SSL certificate, which requires additional setup.
Most home users do not need HTTPS for Pi-hole because the admin dashboard stays on a private network. But if you access it remotely, use it on a shared network, or simply want the practice, the process involves either a self-signed certificate (faster, but triggers warnings) or a real certificate from a certificate authority (more work, but no warnings).
Key Takeaways
- Pi-hole's admin interface runs on HTTP by default, which sends login credentials and DNS data in plain text across your network.
- A self-signed certificate takes 10 minutes to create and enables HTTPS immediately, but your browser will warn you that the certificate is untrusted.
- A real SSL certificate from Let's Encrypt requires a domain name and a way to prove you own it, but eliminates browser warnings.
- After creating a certificate, you configure Pi-hole's lighttpd web server to use it and restart the service.
- HTTPS in Pi-hole does not encrypt your DNS queries to upstream servers — only the connection to the admin dashboard.
Creating a self-signed certificate in five minutes
A self-signed certificate is one you create yourself without a certificate authority. Your browser will not trust it, but the connection will still be encrypted. This is the fastest route if you want HTTPS today.
Log into your Pi-hole machine via SSH and run these commands in order:
- Create a directory for the certificate: sudo mkdir -p /etc/lighttpd/certs
- Generate the certificate and key in one file: sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/lighttpd/certs/pihole.pem -out /etc/lighttpd/certs/pihole.pem
- When prompted, fill in the certificate details. For "Common Name", enter your Pi-hole's IP address or hostname. You can press Enter to skip other fields.
- Set the correct permissions: sudo chmod 600 /etc/lighttpd/certs/pihole.pem
The certificate is now ready. You'll configure lighttpd to use it in the next section.
Configuring lighttpd to use your certificate
Pi-hole uses lighttpd, a lightweight web server, to serve the admin dashboard. You need to tell lighttpd where your certificate is and enable HTTPS on port 443.
Open the lighttpd configuration file:
- sudo nano /etc/lighttpd/lighttpd.conf
- Find the line that says server.port = 80 and add this block below it:
$SERVER["socket"] == ":443" { ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/certs/pihole.pem" }
- Save the file (Ctrl+O, Enter, Ctrl+X in nano).
- Restart lighttpd: sudo systemctl restart lighttpd
Pi-hole now listens on both port 80 (HTTP) and port 443 (HTTPS). You can access the dashboard at https://your-pihole-ip. Your browser will warn you that the certificate is untrusted — this is expected with a self-signed certificate. You can proceed anyway.
Using a real certificate from Let's Encrypt
If you want to eliminate browser warnings, you can obtain a free certificate from Let's Encrypt. This requires a domain name that points to your Pi-hole and a way to prove you own it.
Install Certbot, the Let's Encrypt client:
- sudo apt update && sudo apt install certbot python3-certbot-dns-cloudflare (or the DNS plugin for your provider)
- Run Certbot with your DNS provider's credentials: sudo certbot certonly --dns-cloudflare -d yourdomain.com
- Certbot will verify that you own the domain and create a certificate in /etc/letsencrypt/live/yourdomain.com/
Then update your lighttpd configuration to point to the Let's Encrypt certificate:
- sudo nano /etc/lighttpd/lighttpd.conf
- Change the ssl.pemfile line to: ssl.pemfile = "/etc/letsencrypt/live/yourdomain.com/fullchain.pem" and add ssl.privkey = "/etc/letsencrypt/live/yourdomain.com/privkey.pem"
- Restart lighttpd: sudo systemctl restart lighttpd
Let's Encrypt certificates expire after 90 days. Set up automatic renewal with a cron job or systemd timer so you don't have to renew manually.
Redirecting HTTP traffic to HTTPS
Once HTTPS is working, you may want to redirect anyone who visits http://your-pihole-ip to the secure version automatically. This prevents accidental unencrypted access.
Add this block to your lighttpd configuration file, before the HTTPS block:
$HTTP["scheme"] == "http" { $HTTP["host"] =~ ".*" { url.redirect = ("^/(.*)" => "https://%{HTTP_HOST}/$1") } }
Restart lighttpd again: sudo systemctl restart lighttpd. Now all HTTP requests will redirect to HTTPS.
Troubleshooting certificate and connection issues
If lighttpd fails to start after adding the certificate configuration, check the error log: sudo journalctl -u lighttpd -n 20. Common problems include incorrect file paths, wrong file permissions, or a malformed configuration line.
If your browser still shows a certificate error after restarting lighttpd, clear your browser cache and try again in an incognito window. Some browsers cache certificate errors aggressively. If you're using a self-signed certificate, the warning is normal — look for an "Advanced" or "Proceed Anyway" button.
If HTTPS works but HTTP redirect doesn't, make sure the redirect block is placed before the HTTPS block in your configuration file. Lighttpd processes blocks in order, and a later block can override an earlier one.
Frequently Asked Questions
Does HTTPS in Pi-hole encrypt my DNS queries to the internet?
No. HTTPS in Pi-hole only encrypts the connection between your browser and the admin dashboard. Your DNS queries from devices on your network to Pi-hole still travel over unencrypted DNS (port 53) unless you separately configure DNS-over-HTTPS or DNS-over-TLS on Pi-hole itself. Those are different settings.
Can I use a hostname instead of an IP address?
Yes, if your hostname resolves correctly. For a self-signed certificate, enter your hostname in the "Common Name" field when generating the certificate. For Let's Encrypt, your hostname must point to your Pi-hole's IP address via DNS before you run Certbot.
What if I can't access the dashboard after enabling HTTPS?
Check that port 443 is not blocked by a firewall. Run sudo ufw status to see your firewall rules, and add port 443 if needed: sudo ufw allow 443. Also verify that lighttpd is running: sudo systemctl status lighttpd.
Do I need to update my Pi-hole password after enabling HTTPS?
No. HTTPS only encrypts the connection; it does not change your password or login process. Your existing credentials work the same way.
Can I use both HTTP and HTTPS at the same time?
Yes. By default, lighttpd listens on both port 80 (HTTP) and port 443 (HTTPS) after you add the HTTPS configuration. You can disable HTTP by removing or commenting out the server.port = 80 line if you want HTTPS only.