Hey all,
I am trying to change the webui port in an update-safe way (i.e. persists updates with no manual effort).
Based on some older posts in this forum, it seems like this used to be possible via /etc/lighttpd/external.conf
but now needs to be done via a .conf file placed in /etc/lighttpd/conf-enabled/
. Based on this, I created /etc/lighttpd/conf-enabled/15-lighttpd-external.conf
with the following content:
server.port := 7069
Expected Behaviour:
The server binds to port 7069
Actual Behaviour:
Unfortunately, pihole is still trying to bind to port 80. I get a bunch of these errors in my container logs:
2023-06-12 15:39:21: network.c.369) can't bind to socket: [::]:80: Address already in use
I have verified that my custom conf file has the expected content:
root@pihole:/# cat /etc/lighttpd/conf-enabled/04-external.conf
server.port := 7069
Debug Token:
Here are the lighttpd related lines from my debug log. I can post the entire log if needed.
*** [ DIAGNOSING ]: contents of /etc/lighttpd
-rw-r--r-- 1 root root 2.2K Jan 19 2022 /etc/lighttpd/lighttpd.conf
server.modules = (
"mod_indexfile",
"mod_access",
"mod_alias",
"mod_redirect",
)
server.document-root = "/var/www/html"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
server.feature-flags += ("server.h2proto" => "enable")
server.feature-flags += ("server.h2c" => "enable")
server.feature-flags += ("server.graceful-shutdown-timeout" => 5)
server.http-parseopts = (
"header-strict" => "enable",# default
"host-strict" => "enable",# default
"host-normalize" => "enable",# default
"url-normalize-unreserved"=> "enable",# recommended highly
"url-normalize-required" => "enable",# recommended
"url-ctrls-reject" => "enable",# recommended
"url-path-2f-decode" => "enable",# recommended highly (unless breaks app)
"url-path-dotseg-remove" => "enable",# recommended highly (unless breaks app)
)
index-file.names = ( "index.php", "index.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.conf.pl"
include "/etc/lighttpd/conf-enabled/*.conf"
server.modules += (
"mod_dirlisting",
"mod_staticfile",
)
*** [ DIAGNOSING ]: contents of /etc/lighttpd/conf.d
/etc/lighttpd/conf.d does not exist.
*** [ DIAGNOSING ]: contents of /etc/lighttpd/conf-enabled
total 8.0K
-rw-rw-r-- 1 1000 pihole 20 Jun 12 15:12 04-external.conf
lrwxrwxrwx 1 root root 32 May 30 13:51 05-setenv.conf -> ../conf-available/05-setenv.conf
lrwxrwxrwx 1 root root 35 May 30 13:51 10-accesslog.conf -> ../conf-available/10-accesslog.conf
lrwxrwxrwx 1 root root 33 May 30 13:51 10-fastcgi.conf -> ../conf-available/10-fastcgi.conf
-rw-r--r-- 1 root root 215 Jun 12 16:46 15-pihole-admin-redirect-docker.conf
lrwxrwxrwx 1 root root 38 May 30 13:51 15-pihole-admin.conf -> ../conf-available/15-pihole-admin.conf
lrwxrwxrwx 1 root root 38 May 30 13:51 /etc/lighttpd/conf-enabled/15-pihole-admin.conf -> ../conf-available/15-pihole-admin.conf
server.errorlog := "/var/log/lighttpd/error-pihole.log"
$HTTP["url"] =~ "^/admin/" {
server.document-root = "/var/www/html"
server.stream-response-body = 1
accesslog.filename = "/var/log/lighttpd/access-pihole.log"
accesslog.format = "%{%s}t|%h|%V|%r|%s|%b"
fastcgi.server = (
".php" => (
"localhost" => (
"socket" => "/run/lighttpd/pihole-php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi",
"min-procs" => 1,
"max-procs" => 1,
"bin-environment" => (
"TZ" => "America/Chicago",
"PIHOLE_DOCKER_TAG" => "",
"PHP_ERROR_LOG" => "/var/log/lighttpd/error-pihole.log",
"CORS_HOSTS" => "",
"VIRTUAL_HOST" => "pihole",
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000",
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable",
)
)
)
setenv.add-response-header = (
"X-Pi-hole" => "The Pi-hole Web interface is working!",
"X-Frame-Options" => "DENY",
"X-XSS-Protection" => "0",
"X-Content-Type-Options" => "nosniff",
"Content-Security-Policy" => "default-src 'self' 'unsafe-inline';",
"X-Permitted-Cross-Domain-Policies" => "none",
"Referrer-Policy" => "same-origin"
)
$HTTP["url"] =~ "^/admin/\." {
url.access-deny = ("")
}
$HTTP["url"] =~ "/(teleporter|api_token)\.php$" {
$HTTP["referer"] =~ "/admin/settings\.php" {
setenv.set-response-header = ( "X-Frame-Options" => "SAMEORIGIN" )
}
}
}
else $HTTP["url"] == "/admin" {
url.redirect = ("" => "/admin/")
}
$HTTP["host"] == "pi.hole" {
$HTTP["url"] == "/" {
url.redirect = ("" => "/admin/")
}
}
server.modules += ( "mod_access", "mod_accesslog", "mod_redirect", "mod_fastcgi", "mod_setenv" )