Skip to content

lighttpd

Notes & Warnings

  • This is an unsupported configuration created by the community

Basic requirements

  1. Run basic-install and choose to install the Admin Web Interface. lighttpd is the default webserver installed and used by the pi-hole Admin Web Interface.

Optional configuration

lighttpd config with BLOCK_IPV4 or BLOCK_IPV6 (Note this does not work with TLS due to local server not having local TLS certificates for 1.6+ million ad domains)

Option 1: configure lighttpd 404 error handler (compatibility with old pi-hole behavior) Sample handler: pi-hole used to provide /var/www/html/pihole/index.php Adjust server.error-handler-404 to be the url-path from the virtual host document root (e.g. /var/www/html). If not already enabled, the global lighttpd.conf must be configured for mod_fastcgi to handle .php. (Alternatively, /pihole/index.php could instead be an empty file /404.txt)

Fedora:

echo 'server.error-handler-404 := "/pihole/index.php"' > /etc/lighttpd/conf.d/pihole-block-ip.conf
echo 'include "/etc/lighttpd/conf.d/pihole-block-ip*.conf"' >> /etc/lighttpd/lighttpd.conf
service lighttpd restart

Debian:

echo 'server.error-handler-404 := "/pihole/index.php"' > /etc/lighttpd/conf-available2/08-pihole-block-ip.conf
lighty-enable-mod pihole-block-ip
service lighttpd restart

Option 2: configure lighttpd mod_magnet

Download, review, and copy pihole-block-ip.lua to /etc/lighttpd/pihole-block-ip.lua (sample lua app created by lighttpd dev, also replacing pihole-admin.conf)

Fedora:

echo 'server.modules += ("mod_magnet")' > /etc/lighttpd/conf.d/pihole-block-ip.conf
echo 'magnet.attract-physical-path-to += ("/etc/lighttpd/pihole-block-ip.lua")' >> /etc/lighttpd/conf.d/pihole-block-ip.conf
echo 'include "/etc/lighttpd/conf.d/pihole-block-ip*.conf"' >> /etc/lighttpd/lighttpd.conf
service lighttpd restart

Debian:

echo 'server.modules += ("mod_magnet")' > /etc/lighttpd/conf.d/pihole-block-ip.conf
echo 'magnet.attract-physical-path-to += ("/etc/lighttpd/pihole-block-ip.lua")' >> /etc/lighttpd/conf.d/pihole-block-ip.conf
lighty-enable-mod pihole-block-ip
service lighttpd restart