Host website alongside Pi-Hole interface

How to: Host another website alongside the Pi-Hole admin interface on your Raspbian installation.

1.Create a new folder for your web server in the same folder, the files for the Pi-Hole interface are stored:

mkdir /var/www/html/myserver

It's usually /var/www/html/, but you can look it up in your lighttpd config (stored at /etc/lighttpd/lighttpd.conf) where it is referred to as server.document-root.

2.Set ownership to user www-data:

chown www-data:www-data /var/www/html/myserver

3.Enable virtual hosts:

sudo lighty-enable-mod simple-vhost
sudo service lighttpd force-reload

4.Configure your lighttpd server. Edit /etc/lighttpd/external.conf using this scheme:

$HTTP["host"] == "<DOMAIN>" {
$HTTP["host"] == "my.server" {

    server.modules = (

    server.document-root = "/var/www/html/myserver/"
    server.error-handler-404 = "index.php"
    server.errorlog = "/var/log/lighttpd/error.log"
    server.username = "www-data"
    server.groupname = "www-data"
    server.port = 80

    index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
    url.access-deny             = ( "~", ".inc", ".md", ".yml", ".ini" )
    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",
                        ".js" => "application/javascript",
                        ".json" => "application/json",
                        ".txt"  => "text/plain",
                        ".svg"  => "image/svg+xml" )

5.Check the syntax of your config:

lighttpd -t -f /etc/lighttpd/external.conf

It should return "Syntax OK".

6.Restart lighttpd:

sudo systemctl restart lighttpd

7.Add the domain to your PiHole:

Pi-Hole 5+:
Add the domain using the Local DNS Records section in the web interface.

Older Versions:
Edit "local.list" and add an entry following this scheme:

<Pi-Hole IP> <Domain>