nagios 在虚拟主机 cgi 问题

nagios 在虚拟主机 cgi 问题

我已经将我的 nagios 移到 apaches 虚拟主机上并添加了以下配置文件

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName  nagios.example.com
    ServerAlias nagios.example.com         
    DocumentRoot /usr/local/nagios/share
    ScriptAlias /cgi-bin/nagios /usr/local/nagios/sbin
    ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin 


    # Where the stylesheets (config files) reside
    #Alias /nagios/stylesheets /usr/local/nagios/share 

    # Where the HTML pages live
    Alias /nagios  /usr/local/nagios/share

    <Directory  /usr/local/nagios/share>
        Options FollowSymLinks
        DirectoryIndex index.php
        AllowOverride AuthConfig
        Order Allow,Deny
        Allow From All

        AuthName "Nagios Access"
        AuthType Basic
        AuthUserFile /etc/nagios3/htpasswd.users
        require valid-user
    </Directory>

    </VirtualHost>

当我浏览页面时,我收到以下错误:/cgi-bin/tac.cgi在此服务器上找不到请求的 URL。检查路由scriptaliases似乎一切正常。单击菜单内部时,cgi 问题不再存在,仅在页面浏览时存在。

答案1

你的配置文件看起来不错,只需注释掉以下行

Alias /nagios  /usr/local/nagios/share

因为您已经定义了 DocumentRoot,因此此行与您为 Nagios 定义的路径发生冲突。

答案2

我正在运行 Ubuntu 12.04,为了修复初始 tac.cgi 错误,您必须在 index.html 和 index.php 文件中编辑以下内容。

frame src="/nagios/cgi-bin/tac.cgi" name="main" />

此后初始页面将正确加载。

答案3

我不确定这是否 100% 正确但它 100% 有效。

    <VirtualHost *:80>
    ServerName nagios.example.org
    ServerAlias nagios
    ServerAdmin [email protected]
    DocumentRoot /usr/local/nagios/share

    ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
    ScriptAlias /cgi-bin /usr/local/nagios/sbin
    Alias /nagios  /usr/local/nagios/share

    <Directory /usr/local/nagios/share>
            Options Indexes FollowSymLinks MultiViews
            #  SSLRequireSSL
            AllowOverride None
            Order allow,deny
            Allow from all
            #  Order deny,allow
            #  Deny from all
            #  Allow from 127.0.0.1
            AuthName "Nagios Access"
            AuthType Basic
            AuthUserFile /usr/local/nagios/etc/htpasswd.users
            Require valid-user
    </Directory>

    <Directory "/usr/local/nagios/sbin">
            #  SSLRequireSSL
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            AllowOverride None
            Order allow,deny
            Allow from all
            #  Order deny,allow
            #  Deny from all
            #  Allow from 127.0.0.1
            AuthName "Nagios Access"
            AuthType Basic
            AuthUserFile /usr/local/nagios/etc/htpasswd.users
            Require valid-user
    </Directory>

    ErrorLog /var/log/httpd/nagios_error.log

    LogLevel warn

    CustomLog /var/log/httpd/nagios_access.log combined
    ServerSignature On
    </VirtualHost>

我研究并结合了多种方法后找到了这种布局。如有任何意见,请说明这种布局为什么不正确,或为什么不正确,我将不胜感激。

相关内容