• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

Directory index forbidden

Hi,

I've been trying to figure out why this error comes up when trying to access my nagios installation on OpenBSD.

Directory index forbidden by rule: /nagios/
 Thats the error i get when I try to access http://servername/nagios/

Has anyone been able to resolve this error.
I followed the instructions from http://www.kernel-panic.it/openbsd/nagios/ and have re-looked at the cofigs i did and i just can't figure out what's wrong.

Waisiki
0
itc_sysadmin
Asked:
itc_sysadmin
  • 9
  • 8
1 Solution
 
LinuxGuruLinux Server AdministratorCommented:
Hi,

Could you please paste the output of apache error log? This seems to a permission / ownership issue. We need the exact error in apache logs to troubleshoot the issue.

You can use the following command to monitor apache log.

tail -f /usr/local/apache/log/error_log

The location to error_log may vary.

Cheers !!!
0
 
LinuxGuruLinux Server AdministratorCommented:
Also please place the following code in your .htaccess file and let me know the results.

Options Indexes

0
 
itc_sysadminAuthor Commented:
Here's the apache error_log

# tail -f /var/www/logs/error_log
[Mon Sep  5 04:30:54 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 04:30:54 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 04:30:55 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 04:30:55 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 05:36:56 2011] [notice] caught SIGTERM, shutting down
[Mon Sep  5 05:58:33 2011] [notice] Initializing etag from /var/www/logs/etag-state
[Mon Sep  5 05:58:34 2011] [notice] chrooted in /var/www
[Mon Sep  5 05:58:34 2011] [notice] changed to uid 67, gid 67
[Mon Sep  5 05:58:34 2011] [notice] Apache configured -- resuming normal operations
[Mon Sep  5 05:58:34 2011] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Mon Sep  5 06:16:23 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 06:16:27 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 06:16:28 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 06:16:28 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
[Mon Sep  5 06:16:29 2011] [client 10.2.40.56] Directory index forbidden by rule: /nagios/
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
itc_sysadminAuthor Commented:
> Also please place the following code in your .htaccess file and let me know the results.

> Options Indexes

I've been searching for the .htaccess file and I can't find it in any of the folders.
0
 
itc_sysadminAuthor Commented:
This is the configuration for apache.

ScriptAlias /cgi-bin/nagios "/var/www/cgi-bin/nagios"

<Directory "/var/www/cgi-bin/nagios">
    SSLRequireSSL

    Options ExecCGI

    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /users/nagios.passwd
    Require valid-user

    Order deny,allow
    Deny from all
    # Authorized clients
    Allow from 127.0.0.1 172.16.0.13
</Directory>

Alias /nagios "/var/www/nagios"

<Directory "/var/www/nagios">
    SSLRequireSSL

    Options None
    AllowOverride None

    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /users/nagios.passwd
    Require valid-user

    Order deny,allow
    Deny from all
    # Authorized clients
    Allow from 127.0.0.1 172.16.0.13
</Directory>
0
 
LinuxGuruLinux Server AdministratorCommented:
Hi,

Could you paste the output of the following?

ll /var/www

Make sure to give the correct permission to the nagios directory, otherwise apache wont be able to access it.

0
 
itc_sysadminAuthor Commented:
# ls -l /var/www
total 52
drwxr-xr-x  2 root  daemon   512 Mar 17  2010 bin
drwxr-xr-x  3 root  daemon   512 Sep  4 06:36 cgi-bin
drwxr-xr-x  6 root  daemon   512 Sep  4 15:24 conf
drwxr-xr-x  2 root  daemon   512 Sep  6 02:06 dev
drwxr-xr-x  3 root  daemon   512 Sep  4 06:33 etc
drwxr-xr-x  3 root  daemon   512 Aug 15 07:55 htdocs
drwxr-xr-x  3 root  daemon  3584 Aug 15 07:55 icons
drwxr-xr-x  2 root  daemon   512 Sep  6 02:06 logs
drwxr-xr-x  9 root  daemon   512 Sep  5 11:45 nagios
drwx-----T  2 www   www      512 Sep  4 06:33 tmp
drwxr-xr-x  2 root  daemon   512 Sep  4 15:16 users
drwxr-xr-x  4 root  daemon   512 Sep  4 06:33 var
#
0
 
LinuxGuruLinux Server AdministratorCommented:
Hi,

The permissions seems to be correct. Did you check the installation by running the following command as mentioned in the documentation?

/usr/local/sbin/nagios -v /var/www/etc/nagios/nagios.cfg

??

0
 
LinuxGuruLinux Server AdministratorCommented:
Also please go to the /var/www/nagios directory and create a .htaccess file there with the following content.

Options Indexes
0
 
itc_sysadminAuthor Commented:
> Hi,

>The permissions seems to be correct. Did you check the installation by running the following command >as mentioned in the documentation?
>
>/usr/local/sbin/nagios -v /var/www/etc/nagios/nagios.cfg

> ??

I ran that with  no errors:

# /usr/local/sbin/nagios -v /var/www/etc/nagios/nagios.cfg

Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
        Checked 8 services.
Checking hosts...
        Checked 1 hosts.
Checking host groups...
        Checked 1 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 1 contacts.
Checking contact groups...
        Checked 1 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking service dependencies...
        Checked 0 service dependencies.
Checking host escalations...
        Checked 0 host escalations.
Checking host dependencies...
        Checked 0 host dependencies.
Checking commands...
        Checked 24 commands.
Checking time periods...
        Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
#
0
 
itc_sysadminAuthor Commented:
Hi testez,

I created the .htaccess file in /var/www/nagios/ with Options Indexes, I still get the error.
0
 
LinuxGuruLinux Server AdministratorCommented:
Ok. Sometimes SELinux may cause issues. Make sure to disable it. Also is there a file named index.html in your /var/www/nagios/ ?

Please paste the output of the following.

ls -l /var/www/nagios
0
 
itc_sysadminAuthor Commented:
Hi,

Here it is.

# ls -l /var/www/nagios/
total 68
-rw-r--r--  1 root  daemon    16 Sep  6 11:27 .htaccess
-r--r--r--  1 root  bin      536 Mar 19  2010 config.inc.php
drwxr-xr-x  2 root  daemon  1536 Sep  4 06:37 contexthelp
drwxr-xr-x  3 root  daemon  2560 Sep  4 06:37 docs
drwxr-xr-x  3 root  daemon  1536 Sep  4 06:37 images
drwxr-xr-x  2 root  daemon   512 Sep  4 06:37 includes
-r--r--r--  1 root  bin      718 Mar 19  2010 index.php
-r--r--r--  1 root  bin     3420 Mar 19  2010 main.php
drwxr-xr-x  2 www   daemon   512 Sep  4 06:37 media
-r--r--r--  1 root  bin       26 Mar 19  2010 robots.txt
-r--r--r--  1 root  bin     5714 Mar 19  2010 side.php
drwxr-xr-x  2 root  daemon   512 Sep  4 06:37 ssi
drwxr-xr-x  2 root  daemon   512 Sep  4 06:37 stylesheets
0
 
itc_sysadminAuthor Commented:
I'm using OpenBSD which uses PF. I have disabled pf.
0
 
LinuxGuruLinux Server AdministratorCommented:
Ok. Please create a file index.html with no content and let me know the results.

You can use the following command

touch index.html
0
 
itc_sysadminAuthor Commented:
Hi,

I've tried created the index.html to /var/www/nagios/  folder but still that error still comes up.

I might have rebuild it on another VM and retrace my steps again.

0
 
LinuxGuruLinux Server AdministratorCommented:
Ok.

Normally this can be caused by several things:

1. You have a .htaccess file in the web root directory which has a rule in it to prevent directory index browsing.
2. Your Apache configuration file (httpd.conf) has rules set to disallow directory index browsing.
3. You have no index.html file in that directory and thus it thinks it needs to attempt directory index browsing.
4. Your server doesn't have a rule to use index.php if no index.html file is found

I think we have already checked almost all possible reasons.

Also the ownership and permission for index.php, main.php, side.php, config.inc.php seems to be root:bin and 444. Could you change it to root:daemon and 644 and see the results.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now