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

Apache2permissions

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>

Best Answer

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.