Solved

Directory index forbidden by Options directive: /usr/local/nagios/share/

Posted on 2009-05-11
20
15,912 Views
Last Modified: 2013-12-16
Greetings all!

I have installed the Nagios and used very complete directions at http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html

But i try to access site at http://servername.com/nagios/ i get "You don't have permission to access /nagios/ on this server"

Looking in the error_log file shows:

Directory index forbidden by Options directive: /usr/local/nagios/share/

Here is what my nagios.conf file looks like:

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

<Directory "/usr/local/nagios/sbin">
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user
</Directory>

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

<Directory "/usr/local/nagios/share">
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user
</Directory>

I have looked at all forums, and see nothing that can help. Please help!
0
Comment
Question by:linuxpig
  • 6
  • 5
  • 3
  • +4
20 Comments
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24358961
Do you have SELinux installed ??

If it is then probably you' nagios script can not run because of the executin has bnn stooped by it.

To correct the problem execute this problem:
chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw/

I hope this helps.
 
Cheers,
K.
0
 
LVL 14

Accepted Solution

by:
Deepak Kosaraju earned 200 total points
ID: 24358988
Change the above to following and restart httpd service.
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/cgi"
 

<Directory "/usr/local/nagios/cgi">

   Options ExecCGI

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "Nagios Access"

   AuthType Basic

   AuthUserFile /usr/local/nagios/etc/htpasswd.users

   Require valid-user

</Directory>
 

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

<Directory "/usr/local/nagios/share">

   Options None

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "Nagios Access"

   AuthType Basic

   AuthUserFile /usr/local/nagios/etc/htpasswd.users

   Require valid-user

</Directory>

Open in new window

0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 24360173
It sounds like your attempt to browse the directory is not finding a default document (or there is no default set), and you do not allow for directory browsing in that directory.

Take a look at these directives.  I recommend default document first.  The "Options +Indexes" is probably not what you are looking for.

http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex
http://httpd.apache.org/docs/2.2/mod/core.html#options
0
 

Author Comment

by:linuxpig
ID: 24364562
I am sorry guys, i tried both solutions provided and i get same error.
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 24366912
Did you try setting a default document with DirectoryIndex?  How?  What happened?
0
 
LVL 14

Expert Comment

by:Deepak Kosaraju
ID: 24367045
Cross check the following files are in the directory
[/etc/httpd/conf.d]# cd /usr/local/nagios/share

[/usr/local/nagios/share]# ls -l

total 52

drwxrwxr-x  2 root root  4096 Sep 15  2008 contexthelp

drwxrwxr-x  3 root root  4096 Sep 15  2008 docs

drwxrwxr-x  3 root root  4096 Sep 15  2008 images

-rw-rw-r--  1 root root   732 Sep 15  2008 index.html

-rw-rw-r--  1 root root  3243 Sep 15  2008 main.html

drwxrwxr-x  2 root root  4096 Sep 15  2008 media

-rw-rw-r--  1 root root    26 Sep 12  2008 robots.txt

-rw-rw-r--  1 root root 13538 Sep 15  2008 side.html

drwxrwxr-x  2 root root  4096 Sep 12  2008 ssi

drwxrwxr-x  2 root root  4096 Sep 15  2008 stylesheets

Open in new window

0
 
LVL 14

Expert Comment

by:Deepak Kosaraju
ID: 24367094
Please check the directory permissions that other's have read access.
0
 

Author Comment

by:linuxpig
ID: 24369259
Permissions are nagios:nagios and 777 on /usr/local/nagios/share
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24369379
linuxpig: All your web files are belonging to root!! This should not happen..  Especially dynamic contnent might not be updated this way. There's a great probability that the system cant even read your nagios config file. Youur naigos folder should belong to the user  nagios:nagios.

Will you cange it and retry?

cd /usr/local
chown -R nagios.nagios nagios
0
 

Author Comment

by:linuxpig
ID: 24369543
Changed as requested, still same problem. Here is my /usr/local/nagios dir

drwxrwxr-x 2 nagios nagios 4096 Mar 01 07:12 bin
drwxrwxr-x 3 nagios nagios 4096 Mar 01 07:16 etc
drwxrwxr-x 2 nagios nagios 4096 Mar 01 07:12 libexec
drwxrwxr-x 2 nagios nagios 4096 Mar 01 07:12 sbin
drwxrwxr-x 9 nagios nagios 4096 Mar 01 07:12 share
drwxrwxr-x 5 nagios nagios 4096 Mar 01 07:20 var

Here is my share dir,

-rw-rw-r-- 1 nagios nagios  576 Mar 02 07:12 config.inc.php
drwxrwxr-x 2 nagios nagios 4096 Mar 02 07:12 contexthelp
drwxrwxr-x 3 nagios nagios 4096 Mar 02 07:12 docs
drwxrwxr-x 3 nagios nagios 4096 Mar 02 07:12 images
drwxrwxr-x 2 nagios nagios 4096 Mar 02 07:12 includes
-rw-rw-r-- 1 nagios nagios  718 Mar 02 17:02 index.php
-rw-rw-r-- 1 nagios nagios 3092 Mar 02 17:02 main.php
drwxrwxr-x 2 nagios nagios 4096 Mar 02 17:02 media
-rw-rw-r-- 1 nagios nagios   26 Mar 02 17:02 robots.txt
-rw-rw-r-- 1 nagios nagios 5722 Mar 02 17:02 side.php
drwxrwxr-x 2 nagios nagios 4096 Mar 02 17:02 ssi
drwxrwxr-x 2 nagios nagios 4096 Mar 02 17:02 stylesheets

Here is my nagios.conf

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

<Directory "/usr/local/nagios/sbin">
    Options ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user
</Directory>

Alias /nagios /usr/local/nagios/share

<Directory "/usr/local/nagios/share">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user
</Directory>
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24369646
ok did you restart your nagios service ?
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24369679
If the restart didn't solve your problem I'll suggest you remove and reinstall nagios. It seems to me that the installation has failed somewhere. I'd been set-up nagios using the same guide with no apparent problem part from the initial SELinux issue.
0
 
LVL 27

Assisted Solution

by:caterham_www
caterham_www earned 200 total points
ID: 24369796
Did you place a
DirectoryIndex index.php
into your directory container as suggested above?
#..... other above

Alias /nagios /usr/local/nagios/share
 

<Directory "/usr/local/nagios/share">

DirectoryIndex index.php

   Options None

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "Nagios Access"

   AuthType Basic

   AuthUserFile /usr/local/nagios/etc/htpasswd.users

   Require valid-user

</Directory>

Open in new window

0
 

Author Comment

by:linuxpig
ID: 24370195
I have done the reinstall of Nagios according to the link i said in previous post. I have done this on other server and have no problem like then there. I have compared install and all same. no SELinux issue either.
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24370319
@linuxpig

> caterham_www:
>Did you place a
> DirectoryIndex index.php
> into your directory container as suggested above?

Did you do this ? or you could  have added it to you main HTTPD servers config.
0
 

Author Comment

by:linuxpig
ID: 24451844
I tried this but not working, so i give up on this. I thank all for input!
0
 

Expert Comment

by:slayerduck
ID: 24655218
Don't give up yet, i'd like to see the solution of this because of the simple fact i got the exact same problem. Im running on CentOS 5.
0
 

Expert Comment

by:slayerduck
ID: 24655397
I found the errors in my config file. Im using CentOS5 so I dont know how nagios installed on your OS.

There were 2 errors. First of all there was no / behind the locations. And the folders were wrong. The original conf did this:

ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi"
<Directory "/usr/lib/nagios/cgi">

Alias /nagios "/usr/share/nagios"
<Directory "/usr/share/nagios">

IT SHOULD BE THIS:

ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi-bin/"
<Directory "/usr/lib/nagios/cgi-bin/">

Alias /nagios "/usr/share/nagios/html/"
<Directory "/usr/share/nagios/html/">

Full config here, I dont need any auth because its all internal but you can just uncomment them and make the htpasswd file if you want.


ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi-bin/"
<Directory "/usr/lib/nagios/cgi-bin/">
#      SSLRequireSSL
         Options ExecCGI
         AllowOverride None
         Order allow,deny
         Allow from all
#        Order deny,allow
#        Deny from all
#        Allow from 127.0.0.1
#         AuthName "Nagios Access"
#         AuthType Basic
#         AuthUserFile /etc/nagios/htpasswd.users
#         Require valid-user
</Directory>

Alias /nagios "/usr/share/nagios/html/"
<Directory "/usr/share/nagios/html/">
#        SSLRequireSSL
        Options None
         AllowOverride None
         Order allow,deny
         Allow from all
#        Order deny,allow
#        Deny from all
#        Allow from 127.0.0.1
#         AuthName "Nagios Access"
#         AuthType Basic
#         AuthUserFile /etc/nagios/htpasswd.users
#         Require valid-user
</Directory>
0
 

Author Comment

by:linuxpig
ID: 24697827
I have seen this result as well and added the slashes but it was to no avail. I have uninstalled the program and moved onto Zenoos. Thanks kindly to all who tried to assist
0
 

Assisted Solution

by:nsikkandar
nsikkandar earned 100 total points
ID: 24744493
I had this same problem and fixed by modifying "DirectoryIndex" in "httpd.conf" file in apache "conf" folder.

Restart both Apache and Nagios after this change.

If this does not fix your problem, provide the output of "ls -al /usr/local/nagios/share/"
# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

#

<IfModule dir_module>

    DirectoryIndex index.php

</IfModule>

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now