您无权访问此服务器上的 /nagios/

您无权访问此服务器上的 /nagios/

nagioscore-nagios-4.4.1我已经完成了包含 Web 服务器的默认安装。

通过以下方式连接到网络服务器elinks http://127.0.0.1/nagios/

但是我不能通过服务器外部 IP 连接elinks http://176.xxx.xxx.135/nagios/(或通过外部机器上的 Chrome 连接)

我得到了错误

You don't have permission to access /nagios/ on this server.

我查看了 apache 和 nagios 设置。但我没有发现 apache 配置中需要更改什么。

默认情况下已将/etc/apache2/vhosts.d/nagios.confrequire 127.0.0.1 注释掉。

#        Require host 127.0.0.1

看起来/usr/local/nagios/etc/htpasswd.users正确,并允许我登录并导航127.0.0.1

iptables被禁用。

编辑

Apache 似乎正在监听:80,因为 apache2 默认(测试)网页正在运行。只是 不行/nagios/。我使用的是默认设置vhosts.d/nagios.conf,没有任何更改(只是链接到/etc/apache2/sites-enabled)。在以前的 nagios 安装中,此文件开箱即用。

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   <IfVersion >= 2.3>
      <RequireAll>
         Require all granted
#        Require host 127.0.0.1

         AuthName "Nagios Access"
         AuthType Basic
         AuthUserFile /usr/local/nagios/etc/htpasswd.users
         Require valid-user
      </RequireAll>
   </IfVersion>
   <IfVersion < 2.3>
      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
   </IfVersion>
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
#  SSLRequireSSL
   Options None
   AllowOverride None
   <IfVersion >= 2.3>
      <RequireAll>
         Require all granted
#        Require host 127.0.0.1

         AuthName "Nagios Access"
         AuthType Basic
         AuthUserFile /usr/local/nagios/etc/htpasswd.users
         Require valid-user
      </RequireAll>
   </IfVersion>
   <IfVersion < 2.3>
      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
   </IfVersion>
</Directory>

答案1

确保 nagios 的虚拟主机已设置为监听该地址。错误“您无权访问此服务器上的 /nagios/”表示 Apache 正在监听但不知道 /nagios/ 在哪里。

相关内容