您無權存取此伺服器上的 /nagios/

您無權存取此伺服器上的 /nagios/

nagioscore-nagios-4.4.1我已經完成了包含網頁伺服器的預設安裝。

透過附加到網路伺服器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.conf註解掉 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/ 在哪裡。

相關內容