Last active
November 5, 2021 04:36
-
-
Save kmagdziak/49daac58bad7071e36a738da8aadb58e to your computer and use it in GitHub Desktop.
Running Pi-hole Docker Container with different docker port 80 mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Issue: Changing the docker port 80 to hosted port not 80 causes the following message: | |
[ERROR]: Unable to parse results from queryads.php: Unhandled error message (Invalid domain!) | |
## Solution courtesy of unitpas, modified by kmagdziak | |
docker exec -it pihole apt-get update | |
docker exec -it pihole apt-get install nano | |
docker exec -it pihole bash | |
nano /var/www/html/pihole/index.php | |
change | |
$serverName = htmlspecialchars($_SERVER["HTTP_HOST"]); | |
with | |
$serverName = htmlspecialchars($_SERVER["SERVER_ADDR"]); | |
Ctrl+O to save | |
Ctrl+X to exit | |
reload web page |
Awesome!
Also, instead of updating aptitude cache and installing nano for this single purpose, your can do it this way:
docker exec -it pihole sed -iE 's/"HTTP_HOST"/"SERVER_ADDR"/' /var/www/html/pihole/index.php
This worked for me as well when using https://github.com/gcgarner/IOTstack
IOT Stack
It really works, thank you very much~
Due to a recent update this has now changed, the line to look for is:
$serverName = htmlspecialchars($_SERVER["SERVER_NAME"]);
and as before, change it to
$serverName = htmlspecialchars($_SERVER["SERVER_ADDR"]);
This also worked for me, looks like it needs to make it into the master branch.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works like a charm. Thanks, m8!