nginx配置nagios之nagios配置文件

发布时间:2019-07-19编辑:脚本学堂
本文介绍下,在nginx中配置nagios时,用到的nagios配置文件,感兴趣的朋友参考下。

本节内容:
nagios配置文件

nagios文件应该处于conf/domain/目录下。
nagios配置:
 

复制代码 代码示例:
server 

        listen       80; 
        server_name  192.168.44.44; 
        index index.html index.htm index.php; 
        root  /usr/local/nagios/share; 
        auth_basic "Nagios Access"; 
        auth_basic_user_file /usr/local/nagios/etc/nagiospasswd; 
 
        location ~ .*.(php|php5)?$ 
        { 
                # root /usr/local/nagios/share; 
                # fastcgi_pass  unix:/export/servers/nginx/logs/php-cgi.sock; 
                fastcgi_pass  127.0.0.1:9000; 
                fastcgi_index index.php; 
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
                #include fcgi.conf; 
                include /export/servers/nginx/conf/fastcgi_params; 
        } 
  # www.jb200.com
        location ~ .cgi$ 
        { 
                root  /usr/local/nagios/share; 
                rewrite ^/nagios/cgi-bin/(.*).cgi /$1.cgi break
                fastcgi_pass unix:/export/servers/nginx/logs/perl-fcgi.sock; 
                fastcgi_index index.cgi; 
                #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
                fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name; 
                #fastcgi_param HTTP_ACCEPT_LANGUAGE en_US; 
                include fastcgi_params; 
        } 
 
        location ~ .pl$ 
        { 
                root  /usr/local/nagios/share; 
                fastcgi_pass  unix:/export/servers/nginx/logs/nginx-fcgi.sock; 
                fastcgi_index index.pl; 
                #fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name; 
                fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name; 
                include /export/servers/nginx/conf/fastcgi_params; 
        } 
 
        location /nagios/ 
        { 
                gzip off; 
                alias /usr/local/nagios/share/; 
        } 
 
        location /stylesheets 
        { 
                gzip off; 
                alias /usr/local/nagios/share/stylesheets; 
        } 
 
        location /pub 
        { 
                gzip off; 
                alias /usr/local/nagios/share/docs; 
        } 
 
        location /pnp4nagios { 
                alias /usr/local/pnp4nagios/share; 
                index index.php; 
                try_files $uri $uri/ @pnp4nagios; 
        } 
 
        location @pnp4nagios { 
                fastcgi_pass  127.0.0.1:9000; 
                fastcgi_index       index.php; 
                include        fastcgi_params; 
                fastcgi_split_path_info ^(.+.php)(.*)$; 
                fastcgi_param PATH_INFO $fastcgi_path_info; 
                fastcgi_param SCRIPT_FILENAME /usr/local/pnp4nagios/share/index.php; 
        }