0

I've done a default install of nagioscore-nagios-4.4.1 including the web server.

I CAN attach to the webserver via elinks http://127.0.0.1/nagios/

But I CAN NOT attach via the servers external IP elinks http://176.xxx.xxx.135/nagios/ (or by Chrome on an external machine)

I get the error

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

I've looked through the apache and nagios setup. But I'm not finding what needs to be changed in the apache configuration.

The /etc/apache2/vhosts.d/nagios.conf has the require 127.0.0.1 commented out by default.

#        Require host 127.0.0.1

The /usr/local/nagios/etc/htpasswd.users appears correct and allows me to login and navigate from 127.0.0.1

iptables is disabled.

EDIT

Apache appears to be listening on :80, since the apache2 default (test) webpage is working. Just not the /nagios/. I'm using the default vhosts.d/nagios.conf without any changes (just linked to /etc/apache2/sites-enabled). In previous installs of nagios, this file worked out of the box.

# 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>
  • Have you checked the file system permissions also? – Tommiie Aug 31 '18 at 11:36
  • Check the Apache error logs. – Michael Hampton Aug 31 '18 at 12:18
  • @Tom, I have checked the permissions - and they look correct. nagios:nagios rwxrwxr-x for the files. www-data is in the nagios group, and nagios is in the www-data group. I even tired just changing permissions to 777 for everything nagios as a test - but no change. – BurningKrome Aug 31 '18 at 12:22
  • @Michael Hampton Even with Loglevel set to debug, there's nothing coming out in either the error.log or access.log. And I don't mean no pertinent errors. I mean nothing appear in either when I attempt to access by the external IP address. – BurningKrome Aug 31 '18 at 12:24
  • Is /nagios/ the only path that results in the 403? – Gerald Schneider Aug 31 '18 at 14:57
1

Make sure the virtualhost of nagios is setup to listen on that address. The error "You don't have permission to access /nagios/ on this server" makes it appear that Apache is listening but doesn't know where /nagios/ is.

  • 1
    That would rather result in a 404. – Gerald Schneider Aug 31 '18 at 14:56
  • It appears to be listening on :80, since the apache2 default (test) webpage is working. Just not the /nagios/. I'm using the default vhosts.d/nagios.conf without any changes (just linked to /etc/apache2/sites-enabled. – BurningKrome Aug 31 '18 at 16:30
  • Is your apache version >=2.3 or < 2.3 ? I had this error before and I'm trying to remember exactly what I did to fix it. – Corey Manshack Aug 31 '18 at 21:05
  • Apache 2.4.10 ....... – BurningKrome Sep 1 '18 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.