Hi everyone,
I had to change my internal IP address away from the default 192.168.254.xx due to conflicts when I would connect to my Wireguard vpn on a different network that used this same IP range.
After I did that, I had to of course change the static IP I had given my pi. After I did that, I encountered some issues where in the pihole admin console it was still showing the pihole’s IP as my old 192.168.254.xx address.
Reading online, I saw that running pihole -r would allow you to reconfigure your pihole installation and change that IP address. Unfortunately, after I reconfigured, I could no longer access the pihole admin page at all!
After some thinking, I realized that pihole uses lighttpd to display the admin ui, so I tried executing “service lighttpd start” but I get an error that the lighttpd daemon failed to start:
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-12-28 11:10:04 CST; 5s ago
Process: 1786 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION)
Dec 28 11:10:04 roci systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart.
Dec 28 11:10:04 roci systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
Dec 28 11:10:04 roci systemd[1]: Stopped Lighttpd Daemon.
Dec 28 11:10:04 roci systemd[1]: lighttpd.service: Start request repeated too quickly.
Dec 28 11:10:04 roci systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Dec 28 11:10:04 roci systemd[1]: Failed to start Lighttpd Daemon.
After some more reading, I saw someone suggested looking at the output of sudo journalctl -u lighttpd, which outputs this for me:
-- Logs begin at Sat 2019-12-28 10:55:38 CST, end at Sat 2019-12-28 11:11:39 CST. --
Dec 28 10:56:03 roci systemd[1]: /lib/systemd/system/lighttpd.service:6: PIDFile= references path below legacy directory /var/run/, upda
ting /var/run/lighttpd.pid → /run/lighttpd.pid; please update the unit file accordingly.
Dec 28 10:56:03 roci systemd[1]: Starting Lighttpd Daemon...
Dec 28 10:56:03 roci lighttpd[813]: Duplicate config variable in conditional 0 global: server.error-handler-404
Dec 28 10:56:03 roci lighttpd[813]: 2019-12-28 10:56:03: (configfile.c.1289) source: /etc/lighttpd/conf-enabled/99-dietpi-pihole.conf line: 33 pos: 1 parser fai
led somehow near here: (EOL)
Dec 28 10:56:03 roci lighttpd[813]: 2019-12-28 10:56:03: (configfile.c.1289) source: find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf
' -printf 'include "%p"\n' 2>/dev/null line: 6 pos: 1 parser failed somehow near here: (EOL)
Dec 28 10:56:03 roci lighttpd[813]: 2019-12-28 10:56:03: (configfile.c.1289) source: /etc/lighttpd/lighttpd.conf line: 65 pos: 1 parser failed somehow near here
: (EOL)
Dec 28 10:56:03 roci systemd[1]: lighttpd.service: Control process exited, code=exited, status=255/EXCEPTION
Dec 28 10:56:03 roci systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Dec 28 10:56:03 roci systemd[1]: Failed to start Lighttpd Daemon.
Dec 28 10:56:03 roci systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart.
Dec 28 10:56:03 roci systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 1.
Dec 28 10:56:03 roci systemd[1]: Stopped Lighttpd Daemon.
Dec 28 10:56:03 roci systemd[1]: Starting Lighttpd Daemon...
Dec 28 10:56:03 roci lighttpd[838]: Duplicate config variable in conditional 0 global: server.error-handler-404
Dec 28 10:56:03 roci lighttpd[838]: 2019-12-28 10:56:03: (configfile.c.1289) source: /etc/lighttpd/conf-enabled/99-dietpi-pihole.conf line: 33 pos: 1 parser fai
led somehow near here: (EOL)
Dec 28 10:56:03 roci lighttpd[838]: 2019-12-28 10:56:03: (configfile.c.1289) source: find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf
' -printf 'include "%p"\n' 2>/dev/null line: 6 pos: 1 parser failed somehow near here: (EOL)
Dec 28 10:56:03 roci lighttpd[838]: 2019-12-28 10:56:03: (configfile.c.1289) source: /etc/lighttpd/lighttpd.conf line: 65 pos: 1 parser failed somehow near here
: (EOL)
It continues on for a while but it seems to just be repeats of the above output.
What stands out to me is that it appears to be an issue related to lighttpd.conf and /etc/lighttpd/conf-enabled/99-dietpi-pihole.conf. Is it possible that when I reconfigured pihole with pihole-r, I messed something up? If so, what is the easiest way to repair this? Can I simply reinstall lighttpd using diet-software?
Here are the contents of lighttpd.conf:
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Lighttpd config for Pi-hole
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
###############################################################################
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
# #
# CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE: #
# /etc/lighttpd/external.conf #
###############################################################################
server.modules = (
"mod_access",
"mod_accesslog",
"mod_auth",
"mod_expire",
"mod_compress",
"mod_redirect",
"mod_setenv",
"mod_rewrite"
)
server.document-root = "/var/www/html"
server.error-handler-404 = "/pihole/index.php"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
accesslog.filename = "/var/log/lighttpd/access.log"
accesslog.format = "%{%s}t|%V|%r|%s|%b"
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc", ".md", ".yml", ".ini" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
mimetype.assign = ( ".png" => "image/png",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".html" => "text/html",
".css" => "text/css; charset=utf-8",
".js" => "application/javascript",
".json" => "application/json",
".txt" => "text/plain",
".svg" => "image/svg+xml" )
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
include_shell "find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf' -printf 'include \"%p\"\n' 2>/dev/null"
# If the URL starts with /admin, it is the Web interface
$HTTP["url"] =~ "^/admin/" {
# Create a response header for debugging using curl -I
setenv.add-response-header = (
"X-Pi-hole" => "The Pi-hole Web interface is working!",
"X-Frame-Options" => "DENY"
)
$HTTP["url"] =~ ".ttf$" {
# Allow Block Page access to local fonts
setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
}
}
# Block . files from being served, such as .git, .github, .gitignore
$HTTP["url"] =~ "^/admin/\.(.*)" {
url.access-deny = ("")
}
# Add user chosen options held in external file
# This uses include_shell instead of an include wildcard for compatibility
include_shell "cat external.conf 2>/dev/null"
And then the contents of /etc/lighttpd/conf-enabled/99-dietpi-pihole.conf:
# Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian
# If the URL starts with /admin, it is the Web interface
$HTTP["url"] =~ "^(/html)?/admin/" {
# Create a response header for debugging using curl -I
setenv.add-response-header = (
"X-Pi-hole" => "The Pi-hole Web interface is working!",
"X-Frame-Options" => "DENY"
)
$HTTP["url"] =~ "\.ttf$" {
# Allow Block Page access to local fonts
setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
}
}
# Block . files from being served, such as .git, .github, .gitignore
$HTTP["url"] =~ "^(/html)?/admin/\." {
url.access-deny = ("")
}
# If it's a request to Pi-hole blocking page...
$HTTP["url"] =~ "^(/html)?/pihole/" {
# ... and the request isn't local
$HTTP["remoteip"] !~ "^1(27|92\.168|0|72\.(1[6-9]|2[0-9]|3[0-1]))\." {
# block!
url.access-deny = ("")
}
}
# Enable blocking page via 404 handler
server.error-handler-404 = "/html/pihole/index.php"
Any help would be very appreciated!!