Skip to content

Instantly share code, notes, and snippets.

@gousiosg
Last active February 16, 2018 10:56
Show Gist options
  • Save gousiosg/12915c795be9f7282fbe to your computer and use it in GitHub Desktop.
Save gousiosg/12915c795be9f7282fbe to your computer and use it in GitHub Desktop.
Nagios on a virtual host with nginx on Debian
server {
listen 80;
server_name nagios.tld.org;
access_log /var/log/nginx/nagios.access.log;
error_log /var/log/nginx/nagios.error.log info;
root /usr/share/nagios3/htdocs;
index index.php index.html;
auth_basic "Nagios Restricted Access";
auth_basic_user_file /etc/nagios3/htpasswd.users;
rewrite ^/nagios3/images/(.*)$ /images/$1;
rewrite ^/nagios3/js/(.*)$ /js/$1;
location ~ \.css/?$ {
root /etc/nagios3/stylesheets/;
rewrite [/nagios3]?/stylesheets/(.*\.css)/?$ /$1;
}
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 unix:/var/run/fcgiwrap.socket;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment