From 9de58589f7412f7c13c1615601718153282d9443 Mon Sep 17 00:00:00 2001 From: Bugscz Date: Mon, 18 Jun 2018 06:31:37 +0200 Subject: [PATCH] How to add pihole blocked page for any nginx 404. --- Nginx-Configuration.asciidoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Nginx-Configuration.asciidoc b/Nginx-Configuration.asciidoc index b3154e6..696b1a3 100644 --- a/Nginx-Configuration.asciidoc +++ b/Nginx-Configuration.asciidoc @@ -51,4 +51,8 @@ server { . `service php7.0-fpm start` #start php7.0-fpm daemon . `service nginx start` #start nginx webserver . If you want to use your custom domain to access admin page (e.g.: `http://mydomain.internal/admin/settings.php` instead of `http://pi.hole/admin/settings.php`), make sure `mydomain.internal` is assigned to `server_name` in `/etc/nginx/sites-available/default`. E.g.: `server_name mydomain.internal;` -. To retain the functionality of the block page when directly accessing blacklisted domains, `$serverName = escapeshellcmd($_SERVER['SERVER_NAME']);` should be replaced with `$serverName = escapeshellcmd($_SERVER['HTTP_HOST']);` in `pihole/index.php`. With Nginx, if `server_name` is not defined in the server config it defaults to `""`, whereas in Lighttpd it defaults to `hostname`. \ No newline at end of file +. To retain the functionality of the block page when directly accessing blacklisted domains, `$serverName = escapeshellcmd($_SERVER['SERVER_NAME']);` should be replaced with `$serverName = escapeshellcmd($_SERVER['HTTP_HOST']);` in `pihole/index.php`. With Nginx, if `server_name` is not defined in the server config it defaults to `""`, whereas in Lighttpd it defaults to `hostname`. +. If you want to use block page for any blocked domain subpage (aka Nginx 404), add this to Pihole server block in your Nginx configuration file: +``` +error_page 404 /pihole/index.php +```