2016-05-01 20:22:51 +00:00
|
|
|
# Pi-hole: A black hole for Internet advertisements
|
2017-02-22 17:55:20 +00:00
|
|
|
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
|
|
# Network-wide ad blocking via your own hardware.
|
|
|
|
#
|
2016-05-01 20:22:51 +00:00
|
|
|
# lighttpd config for Pi-hole
|
|
|
|
#
|
2017-02-22 17:55:20 +00:00
|
|
|
# This file is copyright under the latest version of the EUPL.
|
|
|
|
# Please see LICENSE file for your rights under this license.
|
|
|
|
|
2017-02-09 16:00:52 +00:00
|
|
|
###############################################################################
|
|
|
|
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
|
|
|
|
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
|
|
|
|
# #
|
2017-10-09 08:53:45 +00:00
|
|
|
# CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE: #
|
2017-02-09 16:00:52 +00:00
|
|
|
# /etc/lighttpd/external.conf #
|
|
|
|
###############################################################################
|
|
|
|
|
2016-05-01 20:22:51 +00:00
|
|
|
server.modules = (
|
|
|
|
"mod_access",
|
2016-09-20 09:38:58 +00:00
|
|
|
"mod_auth",
|
2016-05-01 20:22:51 +00:00
|
|
|
"mod_fastcgi",
|
|
|
|
"mod_accesslog",
|
|
|
|
"mod_expire",
|
|
|
|
"mod_compress",
|
|
|
|
"mod_redirect",
|
|
|
|
"mod_setenv",
|
|
|
|
"mod_rewrite"
|
|
|
|
)
|
|
|
|
|
|
|
|
server.document-root = "/var/www/html"
|
2019-07-03 02:28:23 +00:00
|
|
|
server.error-handler-404 = "/pihole/index.php"
|
2016-05-01 20:22:51 +00:00
|
|
|
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
|
|
|
|
server.errorlog = "/var/log/lighttpd/error.log"
|
|
|
|
server.pid-file = "/var/run/lighttpd.pid"
|
|
|
|
server.username = "lighttpd"
|
|
|
|
server.groupname = "lighttpd"
|
|
|
|
server.port = 80
|
2017-02-09 16:00:52 +00:00
|
|
|
accesslog.filename = "/var/log/lighttpd/access.log"
|
|
|
|
accesslog.format = "%{%s}t|%V|%r|%s|%b"
|
2016-05-01 20:22:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
|
2017-09-21 21:47:37 +00:00
|
|
|
url.access-deny = ( "~", ".inc", ".md", ".yml", ".ini" )
|
2016-05-01 20:22:51 +00:00
|
|
|
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",
|
2019-12-07 11:46:14 +00:00
|
|
|
".js" => "application/javascript; charset=utf-8",
|
2016-05-01 20:22:51 +00:00
|
|
|
".json" => "application/json",
|
2016-10-04 23:20:30 +00:00
|
|
|
".txt" => "text/plain",
|
|
|
|
".svg" => "image/svg+xml" )
|
2016-05-01 20:22:51 +00:00
|
|
|
|
|
|
|
# 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.assign.pl"
|
|
|
|
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
|
|
|
|
|
|
|
|
fastcgi.server = ( ".php" =>
|
|
|
|
( "localhost" =>
|
|
|
|
(
|
2016-05-14 22:35:40 +00:00
|
|
|
"socket" => "/tmp/php-fastcgi.socket",
|
2016-05-01 20:22:51 +00:00
|
|
|
"bin-path" => "/usr/bin/php-cgi"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# If the URL starts with /admin, it is the Web interface
|
|
|
|
$HTTP["url"] =~ "^/admin/" {
|
2017-10-10 02:17:33 +00:00
|
|
|
# Create a response header for debugging using curl -I
|
2017-05-02 07:24:55 +00:00
|
|
|
setenv.add-response-header = (
|
|
|
|
"X-Pi-hole" => "The Pi-hole Web interface is working!",
|
|
|
|
"X-Frame-Options" => "DENY"
|
|
|
|
)
|
2017-10-10 02:17:33 +00:00
|
|
|
|
2017-05-02 07:24:55 +00:00
|
|
|
$HTTP["url"] =~ ".ttf$" {
|
|
|
|
# Allow Block Page access to local fonts
|
|
|
|
setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
|
2017-02-21 19:38:09 +00:00
|
|
|
}
|
2018-10-26 18:12:11 +00:00
|
|
|
}
|
2017-02-21 19:38:09 +00:00
|
|
|
|
2018-10-26 18:12:11 +00:00
|
|
|
# Block . files from being served, such as .git, .github, .gitignore
|
|
|
|
$HTTP["url"] =~ "^/admin/\.(.*)" {
|
|
|
|
url.access-deny = ("")
|
2017-09-21 21:47:37 +00:00
|
|
|
}
|
|
|
|
|
2016-09-20 09:38:58 +00:00
|
|
|
# Add user chosen options held in external file
|
2018-10-31 01:52:42 +00:00
|
|
|
# This uses include_shell instead of an include wildcard for compatibility
|
2018-10-26 18:12:11 +00:00
|
|
|
include_shell "cat external.conf 2>/dev/null"
|