Reach admin page when PiHole is on Apache server and port 81

Hi everyone, here's another noob trying to access the configuration page of the PiHole I just installed. I couldn't find any post relating to my setup. Here we go:

Mac running PiHole successfully on docker with Apache server. Also port 80 was in use (I think by Homebridge) so I set it to 81. My guess is that the problem lies within the fact lighttpd wasn't used by default on my pc and that port 80 was used by another service.

I have tried every single web address to access the admin page, I usually get a 404 error or Safari can't find the server. Same with Firefox:
http://192.168.1.35:8181/admin
http://192.168.1.35:81/admin
http://192.168.1.35:5353/admin
http://192.168.1.35:53/admin
http://pi.hole/admin
http://pi-hole/admin

The pihole -r or pihole -d commands on Terminal give me the command not found result. The ones that do work give me the following results:
curl -i http://192.168.1.35/admin
HTTP/1.1 404 Not Found
Date: Sun, 07 Jul 2024 08:39:58 GMT
Server: Apache/2.4.59 (Unix)
Content-Length: 196
Content-Type: text/html; charset=iso-8859-1

404 Not Found

Not Found

The requested URL was not found on this server.

and

nslookup pi.hole
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: pi.hole
Address: 192.168.1.35

Is there an IT hero that can guide me through this like I'm 5? I'm willing to reward for the services with a modest Paypal gift. Cheers!

Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

And please also share your docker-compose file or docker run script for your Pihole container.

Thanks for the quick reply. However, when I enter the pihole -d command Terminal gives me the following prompt: zsh: command not found: pihole. I can't access the web interface so unable to generate a debug log.

Seems that you did run those commands on your host OS?

For a dockered Pi-hole, you'd need to run pihole commands from within the container.

Note that rather than reconfiguring by running pihole -r, you'd populate the respective Docker environment variables for your Pi-hole container.

And in addition to the debug token:

Hey, thanks again for taking the time to troubleshoot this!

The container debug file gives me this: https://tricorder.pi-hole.net/qqqH8VqT/

The script I used:
docker run -d --name pihole -e ServerIP=host IP -e TZ=Europe/Brussels -e WEBPASSWORD=password -e DNS1=1.1.1.1 -e DNS2=1.0.0.1 -p 81:81 -p 53:53/tcp -p 53:53/udp -p 443:443 -v ~/pihole/:/etc/pihole/ --dns=127.0.0.1 --dns=1.1.1.1 --cap-add=NET_ADMIN --restart=unless-stopped pihole/pihole:latest

DNS1 and DNS2 have been deprecated a long time ago; use -e PIHOLE_DNS_=1.1.1.1;1.0.0.1 instead (see also GitHub - pi-hole/docker-pi-hole: Pi-hole in a docker container).

But more importantly, Pi-hole's webserver is listening on port 80 inside the container, so you want to map port 81 to port 80: -p 81:80.

I modified the docker compose file but the Terminal now gives: zsh: command not found: 1.0.0.1
I paid attention to punctuation but it won't run like this: docker run -d --name pihole -e ServerIP=192.168.1.35 -e TZ=Europe/Brussels -e WEBPASSWORD=password -e PIHOLE_DNS_=1.1.1.1;1.0.0.1 -p 81:80 -p 53:53/tcp -p 53:53/udp -p 443:443 -v ~/pihole/:/etc/pihole/ --dns=127.0.0.1 --dns=1.1.1.1 --cap-add=NET_ADMIN --restart=unless-stopped pihole/pihole:latest

Gonna try the first configuration but with the -p 81:80 and come back to you :slight_smile:

Tried the first configuration but still can't load the admin page.
http://www.192.168.1.35:80/admin
http://www.192.168.1.35:81/admin
http://www.192.168.1.35:8180/admin
Won't work but I'm not sure which one to use?

Got it working by removing 127.0.0.1 in my host wifi DNS settings.
However, only by using the deprecated DNS1/2 script from earlier.
Any idea why Terminal gives the zsh: command not found: 1.0.0.1 when trying the PIHOLE_DNS_=1.1.1.1;1.0.0.1 line?

Your shell interpreted the ; as a command terminator.

To avoid that, you should either escape that character or put the parameter value in quotes, e.g. "1.1.1.1;1.0.0.1".

Thanks again for the help

No.
You need to use the correct characters:

  • The values need to be separated by semicolons (;), but you used a colon. This will fail.

  • You need to pay attention to the quotation marks:

    The text above is using "Curly quotation marks" ( and ).
    Do not copy/paste text with this marks.
    They are not interpreted as quotes in a terminal window.

    You need to use the regular quotation marks: (").

    PIHOLE_DNS_="1.1.1.1;1.0.0.1" ### Correct quotation marks
    
    PIHOLE_DNS_=“1.1.1.1;1.0.0.1” ### Wrong quotation marks
    
    # This will be interpreted as 2 commands separated by a semicolon:
    PIHOLE_DNS_=“1.1.1.1;  # Command 1
    1.0.0.1”               # Command 2
    

Wow great attention to detail! Got the script working thank you guys :slight_smile: @Bucking_Horn @rdwebdesign if you send me your email in PM I'll make it up to you. Cheers :+1:

Thanks for the offfer - there's absolutely no need for individual compensation (speaking for myself). :wink:

We're here to help you helping us to make your Pi-hole experience as much of a success as possible, and to improve Pi-hole just a little bit further. :slight_smile:

If you are intent on giving back financially, consider donating to the project via Donate – Pi-hole.

I agree. No need for individual compensation.