禁止在FreeBSD上使用Nagios的Apache 403

我在/usr/local/etc/apache24/Includes有以下conf文件,当我尝试login到Nagios GUI时,我得到了一个403禁止。 我想这与Apache访问Nagios数据的权限问题,但我不知道如何解决这个问题。 我没有将www用户添加到nagios组,并且这些文件位于/usr/local/www/nagios/cgi-bin/可执行,并且由nagios组可读。 我也在httpd.conf文件中启用了cgi_modules

 ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/ Alias /nagios /usr/local/www/nagios/ <Directory /usr/local/www/nagios> Options None AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUSerFile /usr/local/etc/nagios/htpasswd.users Require valid-user </Directory> <Directory /usr/local/www/nagios/cgi-bin> Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUSerFile /usr/local/etc/nagios/htpasswd.users Require valid-user </Directory> 

我该如何解决这个问题?

Nagios版本:4.3.4

Apache版本:24

FreeBSD 11

更新1:

我修改了httpd.conf文件中的目录索引部分以包含index.php

 <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> 

我看到下面的网页

 <?php include_once(dirname(__FILE__).'/includes/utils.inc.php'); // Allow specifying main window URL for permalinks, etc. $url = $cfg['cgi_base_url'].'/tac.cgi'; if ("yes" == "yes" && isset($_GET['corewindow'])) { // The default window url may have been overridden with a permalink... // Parse the URL and remove permalink option from base. $a = parse_url($_GET['corewindow']); // Build the base url. $url = htmlentities($a['path']).'?'; $url = (isset($a['host'])) ? $a['scheme'].'://'.$a['host'].$url : '/'.$url; $query = isset($a['query']) ? $a['query'] : ''; $pairs = explode('&', $query); foreach ($pairs as $pair) { $v = explode('=', $pair); if (is_array($v)) { $key = urlencode($v[0]); $val = urlencode(isset($v[1]) ? $v[1] : ''); $url .= "&$key=$val"; } } if (preg_match("/^http:\/\/|^https:\/\/|^\//", $url) != 1) $url = "main.php"; } $this_year = '2017'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> <script LANGUAGE="javascript"> var n = Math.round(Math.random() * 10000000000); document.write("<title>Nagios Core on " + window.location.hostname + "</title>"); document.cookie = "NagFormId=" + n.toString(16); </script> <link rel="shortcut icon" href="images/favicon.ico" type="image/ico"> </head> <frameset cols="180,*" style="border: 0px;"> <frame src="side.php" name="side" frameborder="0" style=""> <frame src="<?php echo $url; ?>" name="main" frameborder="0" style=""> <noframes> <!-- This page requires a web browser which supports frames. --> <h2>Nagios Core</h2> <p align="center"> <a href="https://www.nagios.org/">www.nagios.org</a><br> Copyright &copy; 2010-<?php echo $this_year; ?> Nagios Core Development Team and Community Contributors. Copyright &copy; 1999-2010 Ethan Galstad<br> </p> <p> <i>Note: These pages require a browser which supports frames</i> </p> </noframes> </frameset> </html> 

但错误Cannot serve directory /usr/local/www/nagios/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive还没有消失。

所以目录索引可能是这里的问题。

 <IfModule dir_module> DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps </IfModule> 

完整的文档在这里: https : //support.nagios.com/kb/article.php?id=96#FreeBSD