Skip to content

Instantly share code, notes, and snippets.

@merouanekhalili
Created March 13, 2018 10:38
Show Gist options
  • Save merouanekhalili/d31d935b1389cc2108fa46799d22b21b to your computer and use it in GitHub Desktop.
Save merouanekhalili/d31d935b1389cc2108fa46799d22b21b to your computer and use it in GitHub Desktop.
nginx config for nagios 4 + nagvis
server {
server_name _;
access_log /var/log/nginx/localhost-access.log;
error_log /var/log/nginx/localhost-error.log;
index index.php index.html;
location /nagios {
auth_basic "Private";
auth_basic_user_file /usr/local/nagios/etc/htpasswd.users;
alias /usr/local/nagios/share;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
location ~ \.cgi$ {
root /usr/local/nagios/sbin;
rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
location /nagvis {
alias /usr/local/nagios/share/nagvis/share;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment