原文地址:http://blog.fraktalgemuese.de/index.php/2011/02/08/icinga-nagios-auf-nginx/ 参考下边配置即可。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
server {
listen 80;
server_name *****;
access_log /var/wwwaccess.log;
error_log /var/wwwerror.log;
location / {
root /usr/local/icinga/share;
index index.html;
# fix image, css and javascript urls
# FIXME: find smarter way to fix path
rewrite ^/icinga/images/(.*)\.(.*) /images/$1.$2 break;
rewrite ^/icinga/stylesheets/(.*)\.css /stylesheets/$1.css break;
rewrite ^/icinga/js/(.*)\.(.*) /js/$1.$2 break;
auth_basic "Restricted";
auth_basic_user_file /usr/local/icinga/etc/htpasswd.users;
}
location ~ \.cgi$ {
# define root directory for CGIs
root /usr/local/icinga/sbin;
rewrite ^/icinga/cgi-bin/(.*)\.cgi /$1.cgi break;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:49233;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/icinga/sbin/$fastcgi_script_name;
auth_basic "Restricted";
auth_basic_user_file /usr/local/icinga/etc/htpasswd.users;
# without passing these parameters you will not be allowed to view/do anything
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}
}