Pihole on a raspberry pi: running Nagios4 on lighttpd alongside

Hi,

I've been struggling with this but can't get it to work.
I've added nagios4 and it's running fine.
Since pihole is already using lighttpd I thought I want to use lighttpd as well for the Nagios page.
However, somehow I can't get it work.

I've added the following to /etc/lighttpd/conf-enabled/10-nagios4.conf:

# Nagios4
alias.url += (
    "/cgi-bin/nagios" => "/usr/lib/cgi-bin/nagios4",
    "/nagios/cgi-bin" => "/usr/lib/cgi-bin/nagios4",
    "/nagios" => "/usr/share/nagios4",
    "/pnp4nagios" => "/opt/pnp4nagios/share"
)
 
$HTTP["url"] =~ "^/nagios/cgi-bin" {
    cgi.assign = ( "" => "" )
}
 
$HTTP["url"] =~ "nagios" {
    auth.backend = "htpasswd"
    auth.backend.htpasswd.userfile = "/etc/nagios4/htpasswd.users"
    auth.require = ("" => (
            "method" => "basic",
            "realm" => "nagios",
            "require" => "valid-user"
        )
    )
}

THe syntax is ok but when I go to http://iphole/nagios it will redirect always to the 'Did you mean to go to the admin panel?'-page.

Could someone tell me please how to make this work?

Thanks in advance.

run one of them on a non-default port? 8088 for example?

That’s not relevant. I want to use the nagios webspace within lighttpd of pihole. I don’t want to run another webserver just for nagios. It should be possible but I don’t know how.

i misunderstood. obviously.

I'm not extremely familiar with lighthttp config context, but their documentation says that "=~" matches based on Perl style RE. I'm assuming you want to catch anything with "nagios" in the URL and direct it specifically to nagios, so you would probably want greedy matching with some anchors.

However, I'm not sure how you would handle having different document roots (one for pihole and one for nagios). It seems like a virtual host would be much easier than trying to adjust based on the URL.

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