Skip to content

Instantly share code, notes, and snippets.

@smukkejohan
Created February 6, 2012 19:07
Show Gist options
  • Save smukkejohan/1754118 to your computer and use it in GitHub Desktop.
Save smukkejohan/1754118 to your computer and use it in GitHub Desktop.
Nagios with Nginx configuration
server {
listen 80;
server_name nagios.example.tld;
access_log /var/log/nginx/nagios.access.log;
error_log /var/log/nginx/nagios.error.log info;
expires 31d;
root /usr/share/nagios3/htdocs;
index index.php index.html;
auth_basic "Nagios Restricted Access";
auth_basic_user_file /etc/nagios3/htpasswd.users;
location /stylesheets {
alias /etc/nagios3/stylesheets;
}
location ~ \.cgi$ {
root /usr/lib/cgi-bin/nagios3;
rewrite ^/cgi-bin/nagios3/(.*)$ /$1;
include /etc/nginx/fastcgi_params;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/nagios3$fastcgi_script_name;
fastcgi_pass fcgiwrap;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass php;
}
}
@Phoenix616
Copy link

Nagios did not work for me until I added the following line to the virtualhost file:

rewrite ^/nagios3/(.*)$ /$1 break;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment