My PiHole runs on a network where I am not the only user, which I’d imagine is the case for most. I wanted a way to allow others on my network to temporarily disable PiHole so that they could access stuff like Google Shopping without needing me to manually disable it (or whitelist the ad servers that Google Shopping links run through).
I decided to build a rudimentary “disable” panel that I could run on an old device and mount somewhere. I used an iPhone 4s, but I’d imagine you could use any old touchscreen device with WiFi and a browser. I’ve posted the project to GitHub, and if you don’t need all the details you can head straight to that here: https://github.com/mattwebbio/pihole-disable-buttons
For the rest, here’s how to get it up and running yourself:
1. Install a Web Server
I’m running Nginx — if you host this script on your PiHole server, you can follow this tutorial with the following modifications:
- You don’t need SQL for this particular application — you can install this if you want, but otherwise skip this section.
- PiHole uses port 80, so you need to change the port Nginx is listening on — to do this, change
listen 8080or similar.
- If you want a nicer looking hostname for the PiHole server (“pihole.lan” instead of “10.0.0.2”), you can set up an Nginx server block/virtual host using this tutorial and then make PiHole forward the matching DNS entry using step #2 of my tutorial here (if you don’t use Docker, just place these entries in a file in
2. Install the App
- Enter the directory where you want to host the app — if you installed Nginx as suggested above, this would be
cd /var/www/(and optionally
mkdir FOLDERNAME && cd FOLDERNAME).
- Download the code:
git clone https://github.com/mattwebbio/pihole-disable-buttons.git .
config.phpand edit it:
cp config.example.php config.php && nano config.php
- Enter your API URL and API key (the config file says where to find these — if you’re hosting on the same server, it’ll probably be
3. Setup the Client Device
As I used an iPhone, I’ve got more information for iOS — but you can follow these directions loosely as you find fit.
- Direct the web browser to where you’re hosting the panel — i.e.
- Lock the screen to the browser and block browsing to other pages. I’m sure there are “kiosk” type apps that will allow you to do this on Android, but on iOS this can also be done with Guided Access:
- On iOS 9, disable screen timeout in Settings -> General -> Auto-Lock and set to “Never”.
- Enable Guided Access in Settings -> General -> Accessibility -> Toggle “Guided Access” and “Accessibility Shortcut”
- Go back to Safari, enter the panel address and click “go”
- Triple-click the home button to open Guided Access
- Click “Options” and disable all the unnecessary items (everything but “Touch”)
- Draw squares with your finger around the address bar and around the bottom bar (forward/back/tabs) — this will prevent the user from navigating away from the page.
- Click “Start” in the top right corner.