diff --git a/advanced/lighttpd.conf b/advanced/lighttpd.conf index a103c3ee..37763f97 100644 --- a/advanced/lighttpd.conf +++ b/advanced/lighttpd.conf @@ -2,6 +2,7 @@ server.modules = ( "mod_expire", "mod_compress", "mod_redirect", + "mod_setenv", "mod_rewrite" ) @@ -26,13 +27,20 @@ include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port include_shell "/usr/share/lighttpd/create-mime.assign.pl" include_shell "/usr/share/lighttpd/include-conf-enabled.pl" -# Set access to 1 day for better query performance when the list gets so large -# http://jacobsalmela.com/raspberry-pi-block-ads-adtrap/#comment-2013820434 -$HTTP["url"] =~ "^/pihole/" { - expire.url = ("" => "access plus 1 days") +# 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!" ) } -# Rewrites all URLs to the /var/www/pihole/index.html -$HTTP["host"] =~ ".*" { - url.rewrite = (".*" => "pihole/index.html") +# If the URL does not start with /admin, then it is a query for an ad domain +$HTTP["url"] =~ "^(?!/admin)/.*" { + # Create a response header for debugging using curl -I + setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) + + # Set the cache to 1 day for better performance + expire.url = ("" => "access plus 1 days") + + # Send the query into the black hole + url.rewrite = (".*" => "pihole/index.html" ) }