<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    成就夢想

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      21 隨筆 :: 22 文章 :: 6 評論 :: 0 Trackbacks


    1,nagios install 參考官方 

    https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf#_ga=1.136427443.2075387674.1488266439

    上面只是參考,請自行安裝最新版本的nagios,并自行忽略掉Apache的配置,我們來配置nginx支持nagios。

    2,理解什么是cgi。fastcgi。寫的非常棒。要多棒有多棒。

    參考文章:http://www.cnblogs.com/skynet/p/4173450.html





    3,上文理解了,就好辦了。我們的目的就是讓nginx支持執行我們nagios下的cgi。nginx基于安全性等考慮不讓直接執行cgi,但支持fastcgi,所以我們要用到一個fastcig的warp來封裝cgi

    github上開源的項目 fcgiwarp https://github.com/gnosek/fcgiwrap


    git clone https://github.com/gnosek/fcgiwrap.git

    autoreconf -i
    ./configure
    make
    make instal
    ps:
    如果aotoreconf執行不了,請自行安裝autoreconf。


    然后就是怎么使用fcgiwarp ,作者提到了2種使用方法(針對這2種方法在nginx配置稍微不同):

    usage

    Most probably you will want fcgiwrap be launched by www-servers/spawn-fcgi. Or you could use the author's Perl launcher - see the homepage for that.



    第1種是作者自己寫的perl 的啟動器:作者說在他的主頁呢。。。。copy一下放在下面
    #!/usr/bin/perl

    use strict;
    use warnings FATAL => qw( all );

    use IO::Socket::UNIX;

    my $bin_path = '/usr/local/bin/fcgiwrap';
    my $socket_path = $ARGV[0] || '/tmp/cgi.sock';
    my $num_children = $ARGV[1] || 1;

    close STDIN;

    unlink $socket_path;
    my $socket = IO::Socket::UNIX->new(
        Local => $socket_path,
        Listen => 100,
    );

    die "Cannot create socket at $socket_path: $!\n" unless $socket;

    for (1 .. $num_children) {
        my $pid = fork;
        die "Cannot fork: $!" unless defined $pid;
        next if $pid;

        exec $bin_path;
        die "Failed to exec $bin_path: $!\n";
    }

    我們把這個文件保存成 /etc/init.d/fcgiwrap 做成服務執行即可。


    第二種方法是用fastcgi的進程管理器來啟動。

    還是GitHub上開源的牛逼項目
    spawn-fcgi   https://github.com/lighttpd/spawn-fcgi

    我們寫一個啟動腳本 

     

    spawn-fcgi -f /usr/local/sbin/fcgiwrap -p 9009                       這個端口自己根據機器的端口使用情況自己來寫



    最后貼一個nginx簡單的配置。

    vim /etc/nginx/conf.d/nagios.conf  #根據自己的nginx啟動位置自行調整


    server {
            server_name nagios.tony.com;  #自己的域名
            access_log /var/log/nginx/nagios-access.log;
            error_log /var/log/nginx/nagios-error.log; #日志位置,發現nagios不能在瀏覽器展示,請看日志,看日志,

    #       auth_basic "Private";
    #
           auth_basic_user_file /etc/nagios/htpasswd.users;   #把認證先去掉。跑起來在說在。 要把 /usr/local/nagios/etc/cgi.cfg  中的use_ssl_authentication=0


            root /usr/local/nagios/share; #/usr/local/nagios   nagios安裝目錄
            index index.php index.html;

        #php 的配置,請自行去解決。
             location ~ \.php$ {  
                include /etc/nginx/fastcgi_params;
                fastcgi_pass  127.0.0.1:9000; #php-fpm 
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
                                        }
            location /nagios {
                 alias /usr/local/nagios/share;
                                    }

             location ~ \.cgi$ {
                    root /usr/local/nagios/sbin;
                    rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
                    include /etc/nginx/fastcgi_params;

                    fastcgi_param AUTH_USER $remote_user;
                    fastcgi_param REMOTE_USER $remote_user;
                    fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin/$fastcgi_script_name;
                    fastcgi_pass  unix:/tmp/cgi.sock; #這是上面第一種方式的配置。
                    #fastcgi_pass  127.0.0.1:9009; #這是上面第二種方式的配置。
                                    }
    }
    posted on 2017-03-01 11:35 iamct 閱讀(236) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: aa级毛片毛片免费观看久| 亚洲综合区图片小说区| 四虎免费影院ww4164h| 九九免费观看全部免费视频| 亚洲国产精品lv| 久久国产亚洲观看| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 亚洲∧v久久久无码精品| 在线a毛片免费视频观看| 三年片在线观看免费大全电影| 精品成人一区二区三区免费视频| 亚洲国产精品成人精品软件| 亚洲色无码一区二区三区| mm1313亚洲精品国产| 日本一道高清不卡免费| 青青视频观看免费99| 歪歪漫画在线观看官网免费阅读| 久久精品视频免费播放| 久久久久久影院久久久久免费精品国产小说| 青青免费在线视频| 国产日韩AV免费无码一区二区| 中文字幕无码免费久久9一区9 | 一二三四视频在线观看中文版免费| 久久久久免费看成人影片| 免费观看无遮挡www的小视频| 国产成人精品免费视频动漫| 老司机在线免费视频| 欧洲美熟女乱又伦免费视频| 四虎免费影院4hu永久免费| 亚洲精品无码日韩国产不卡?V| 亚洲色精品vr一区二区三区| 无码久久精品国产亚洲Av影片| 亚洲一区二区三区深夜天堂| 亚洲精品V天堂中文字幕| 一个人免费观看视频在线中文| 日本在线看片免费人成视频1000| 无码国产精品一区二区免费| 亚洲美女高清一区二区三区| 色播亚洲视频在线观看| 一进一出60分钟免费视频| 99精品视频在线观看免费专区|