Skip to content

@kazeburo /nagios_web.psgi
Last active

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
PSGI file to serving Nagios WebUI
use Plack::App::CGIBin;
use Plack::App::PHPCGIFile;
use Plack::Builder;
use Plack::Builder::Conditionals;
my $cgibin = Plack::App::CGIBin->new(
root => "/usr/local/nagios/sbin",
exec_cb => sub { my $file = shift; $file =~ m!\.cgi$! and -x $file },
my $htdocs = Plack::App::PHPCGIFile->new(
root => '/usr/local/nagios/share'
builder {
enable match_if addr([qw!!]), 'ReverseProxy';
enable sub {
my $apps = shift;
sub {
my $env = shift;
return [302,[Location=>'http://'.$env->{HTTP_HOST}.'/nagios/'],['moved']] if $env->{PATH_INFO} =~ m!^/(nagios)?$!;
$env->{REMOTE_USER} = 'nagiosadmin';
$env->{PATH_INFO} .= 'index.php'
if $env->{PATH_INFO} =~ m!^/nagios/([^\.]+/)*$!;
mount '/nagios/cgi-bin' => $cgibin,
mount '/nagios' => $htdocs,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.