Uninstall Pihole

    server.document-root           = "/var/www/html"
    server.upload-dirs             = ("/var/cache/lighttpd/uploads")
    server.errorlog                = "/var/log/lighttpd/error-pihole.log"
    server.pid-file                = "/run/lighttpd.pid"
    server.username                = "www-data"
    server.groupname               = "www-data"
    server.port                    = 8082
    server.feature-flags           = (
        "server.h2proto"                   => "enable",
        "server.h2c"                       => "enable",
        "server.graceful-shutdown-timeout" => 5,
        # 3
    )
    server.http-parseopts          = (
        "header-strict"            => "enable",
        "host-strict"              => "enable",
        "host-normalize"           => "enable",
        "url-normalize-unreserved" => "enable",
        "url-normalize-required"   => "enable",
        # 5
        "url-ctrls-reject"         => "enable",
        "url-path-2f-decode"       => "enable",
        "url-path-dotseg-remove"   => "enable",
        # 8
    )
    index-file.names               = ("index.php", "index.html")
    url.access-deny                = ("~", ".inc")
    static-file.exclude-extensions = (".php", ".pl", ".fcgi")
    alias.url                      = (
        "/javascript" => "/usr/share/javascript",
    )
    server.modules                 = (
        "mod_indexfile",
        "mod_access",
        "mod_alias",
        "mod_redirect",
        "mod_setenv",
        "mod_fastcgi",
        "mod_dirlisting",
        "mod_staticfile",
        # 8
    )


    $SERVER["socket"] == "[::]:80" {
        # block 1

    } # end of $SERVER["socket"] == "[::]:80"

    $HTTP["url"] =~ "^/admin/" {
        # block 2
        server.document-root        = "/var/www/html"
        server.stream-response-body = 1
        accesslog.filename          = "/var/log/lighttpd/access-pihole.log"
        accesslog.format            = "%{%s}t|%h|%V|%r|%s|%b"
        fastcgi.server              = (
            ".php" => (
                "localhost" => (
                    "socket"                => "/tmp/pihole-php-fastcgi.socket",
                    "bin-path"              => "/usr/bin/php-cgi",
                    "min-procs"             => 0,
                    "max-procs"             => 1,
                    "bin-environment"       => (
                        "PHP_FCGI_CHILDREN"     => "4",
                        "PHP_FCGI_MAX_REQUESTS" => "10000",
                        # 2
                    ),
                    # 5
                    "bin-copy-environment"  => ("PATH", "SHELL", "USER"),
                    "broken-scriptfilename" => "enable",
                    # 7
                ),
            ),
        )
        setenv.add-response-header  = (
            "X-Pi-hole"                         => "The Pi-hole Web interface is working!",
            "X-Frame-Options"                   => "DENY",
            "X-XSS-Protection"                  => "0",
            "X-Content-Type-Options"            => "nosniff",
            "Content-Security-Policy"           => "default-src 'self' 'unsafe-inline';",
            # 5
            "X-Permitted-Cross-Domain-Policies" => "none",
            "Referrer-Policy"                   => "same-origin",
            # 7
        )


        $HTTP["url"] =~ "^/admin/\." {
            # block 3
            url.access-deny = ("")

        } # end of $HTTP["url"] =~ "^/admin/\."

        $HTTP["url"] =~ "/(teleporter|api_token)\.php$" {
            # block 4


            $HTTP["referer"] =~ "/admin/settings\.php" {
                # block 5
                setenv.set-response-header = (
                    "X-Frame-Options" => "SAMEORIGIN",
                )

            } # end of $HTTP["referer"] =~ "/admin/settings\.php"
        } # end of $HTTP["url"] =~ "/(teleporter|api_token)\.php$"
    } # end of $HTTP["url"] =~ "^/admin/"
    else $HTTP["url"] == "/admin" {
        # block 6
        url.redirect = (
            "" => "/admin/",
        )

    } # end of $HTTP["url"] == "/admin"

    $HTTP["host"] == "pi.hole" {
        # block 7


        $HTTP["url"] == "/" {
            # block 8
            url.redirect = (
                "" => "/admin/",
            )

        } # end of $HTTP["url"] == "/"
    } # end of $HTTP["host"] == "pi.hole"
}

Now, restart lighttpd:

sudo systemctl restart lighttpd.service

I can access through this link http://192.168.1.2:8082/admin/. But what is the reason for this "error" on the part of the user or what happened?

I'm not sure.

This should not happen on updates, but I will investigate why your case didn't use the original external.conf.

Note:
I think you can restart nginx too. All should work as expected now.

Should I repeat this procedure after the next update?

That should have fixed the problem.
Under normal circumstances, there is no need to do this again.

2 Likes

Thank you very much for your help and time, I appreciate it very much.

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.