Nginx error404 from pihole

Please follow the below template, it will help us to help you!

Expected Behaviour:

Seeing the normal error404 page of PiHole (when using lighttp)

Actual Behaviour:

ERR_INVALID_RESPONSE

So currently i got PiHole working again on my VPS, even have it working with my custom domain and also made the switch from lighttp to nginx (and therefore got https also working!)

Even the load on the top left suddenly works (always had crazy values like 10) and the only last thing what is left to do is to get the error404 from lighttp setup.

My current configuration with NGINX:

I hope someone is able to tell me how i can set the Pihole error back.

unrelated question: is there also a darkmode for the dashboard? Would i need to change anything else if i would make a subdomain like pihole.betavpn.tk?

Are you referring to the blocking page that shows that a domain is blocked and has the option of whitelisting that page?

Hi jfb
Sorry i meant this page:


this one is the one i would love to set as the error404 (visiting anything else then /admin/.

Feel free to ask anymore questions ^^

Are you trying to get NGINX to serve a specific page, when encountering a 404 situation?

If so, that is more of an NGINX configuration issue rather than Pi-hole specific. But this should help you out:
https://www.cyberciti.biz/faq/howto-nginx-customizing-404-403-error-page/

I know how to set a custom error 404 on nginx. It¡¯s just that I want to set the error 404 page that pihole displays. But I can¡¯t seem to get that to work :slight_smile:

Met vriendelijke groet,

Wesley de Vree

Would it be sufficient to copy the code from the Pi-hole one to the NGINX one? Its a pretty straight forward HTML/CSS page that Pi-hole serves by default. So that should probably do the trick? Or am I missing something?

I didn't knew/found the normal html and css of the error 404. i though it was the index.php that somehow knew when something was a error 404.

If you know where the html/css files are, i could easly link the error404 setting in nginx to that file/folder.

lighttpd from Pi-hole has got these directives if might help:

pi@noads:~ $ cat /etc/lighttpd/lighttpd.conf
[..]
server.document-root        = "/var/www/html"
server.error-handler-404    = "pihole/index.php"
[..]

So full path to the 404 handler with a default install is:

/var/www/html/pihole/index.php

Hey that’s a good idea! Could you zip the contents of that page and put it here?
I’ll report my findings back and share my nginx file too :slight_smile:

index.php and blockingpage.css can be found on git:

Gotcha, gimmie a bit, i’ll get this working in a bit :blush:

Got it finnaly working here:
https://betavpn.tk/admind

Had to do some editting tho, but it's luckly not that complicated haha

I'll put my nginx config file here in abit.

thank you so much already for all the help! <3

1 Like

Ohw and make sure your not running an open resolver:

http://www.openresolver.com/

OOps:

http://www.openresolver.com/?ip=betavpn.tk

Thats not a good idea:

https://discourse.pi-hole.net/search?q=open%20resolver

Please close down port 53 UDP with the firewall and only allow trusted IP´s or setup VPN on clients and Pi-hole:

Hi @deHakkelaar!
I got everything fixed, the betavpn.tk domain is no longer needed and i use now the new improved way: https://pihole.deltabot.me/ i run this behind cloudflare so everything interms of security should be good!
http://www.openresolver.com/?ip=pihole.deltabot.me
http://www.openresolver.com/?ip=deltabot.me
The file below is the configuration i'm rocking now :slight_smile:
default.txt (1.4 KB)

I can also share the the way i have the error404 setup, i mainly changed the HREF tags to the domain i'm using (b/c using the paths likie error404/etcetc didn't worked out for me.

Again i want to thank everyone for their help!

few side questions:
Would it be an idea to submit a request to add the favicon to the error404 page?
Is there a darkmode for the dashboard? Or is that in the making?

Its still resolving:

pi@noads:~ $ dig +short test.openresolver.com TXT @betavpn.tk
"open-resolver-detected"

Ah, that's b/c that domain still points to the server directly, i'll remove that domain asap :stuck_out_tongue:

Removing the domain doesnt help.
Addressing the IP address directly instead of name would still result in an open resolver.

EDIT: eg

pi@noads:~ $ dig +short test.openresolver.com TXT @64.52.86.238
"open-resolver-detected"

pi@noads:~ $ dig +short version.bind TXT @64.52.86.238 CHAOS
"dnsmasq-pi-hole-2.80"
1 Like

um ok, what would i need to disable?