Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save realtebo/3d563848439d3e5cc13a8ab410285bcc to your computer and use it in GitHub Desktop.
Save realtebo/3d563848439d3e5cc13a8ab410285bcc to your computer and use it in GitHub Desktop.
Example of nginx configuration for nagios - nagios.conf
server {
#### NOTE: UPDATE THE DOMAIN ACCORDING TO YOUR SETUP ####
server_name nagios.test;
#### NOTE: UPDATE THE PATH ACCORDING TO YOUR SETUP ####
#### This is my Debian 10 vps ####
#### Some systems uses /usr/share/nagios/share ####
root /usr/local/nagios/share;
listen 80;
index index.php index.html index.htm;
access_log nagios.access.log;
error_log nagios.error.log;
auth_basic "Nagios Access";
#### NOTE: UPDATE THE PATH ACCORDING TO YOUR SETUP ####
#### This is my Debian 10 vps ####
auth_basic_user_file /usr/local/nagios/etc/htpasswd.users;
location ~ \.php$ {
try_files $uri = 404;
fastcgi_index index.php;
#### NOTE: UPDATE THE DOMAIN ACCORDING TO YOUR PHP VERSION ####
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
include fastcgi.conf;
}
location ~ \.cgi$ {
#### NOTE: UPDATE THE PATH ACCORDING TO YOUR SETUP ####
#### This is my Debian 10 vps ####
#### Some systems uses /usr/share/nagios/sbin; ####
root /usr/local/nagios/sbin;
rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi.conf;
#### NOTE: UPDATE THE PATH ACCORDING TO YOUR SETUP ####
#### This is my Debian 10 vps ####
#### Some systems uses unix:/run/fcgiwrap.sock; ####
fastcgi_pass unix:/run/fcgiwrap.socket;
}
# Fixes the fact some links are expected to resolve to /nagios
location /nagios {
#### NOTE: UPDATE THE PATH ACCORDING TO YOUR SETUP ####
#### This is my Debian 10 vps ####
#### Some systems uses /usr/share/nagios/sbin; ####
alias /usr/local/nagios/share;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment