Problem + solution on changing lighttpd server port

I've added a file /etc/lighttpd/conf-enabled/99-external.conf with the following content:
server.port := 12080

Expected Behaviour:

Pihole's lighttpd to start and bind on port 12080

Actual Behaviour:

lighttpd is throwing the following error:
network.c.369) can't bind to socket: [::]:80: Permission denied

Root cause:

The file lighttpd.conf is loading /usr/share/lighttpd/use-ipv6.pl before conf-enabled folder, thus using the default server.port

Solution:

Update lighttpd.conf from:

# default listening port for IPv6 falls back to the IPv4 port
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"

to:

include_shell "/usr/share/lighttpd/create-mime.conf.pl"
include "/etc/lighttpd/conf-enabled/*.conf"
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port

The := notation means "override the previous values" so you indeed want 99-extenal.conf to be loaded last.

It would help to know the version of lighttpd you are using, it is possible that you have an old version that does not use that notation.

Hi,

I'm using the docker image (I just realised I forgot to mention it). I understand the := notation and it's taken into account. The problem here is that the line:

include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port

is executed before the line:

include "/etc/lighttpd/conf-enabled/*.conf"

Therefore even if server.port is changed in the additional config, use-ipv6.pl script used the initial value.