[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 16535
  • Last Modified:

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

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
linuxpig
Asked:
linuxpig
  • 6
  • 5
  • 3
  • +4
3 Solutions
 
Kerem ERSOYPresidentCommented:
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
 
Deepak KosarajuDevOps EngineerCommented:
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
 
Steve BinkCommented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
linuxpigAuthor Commented:
I am sorry guys, i tried both solutions provided and i get same error.
0
 
Steve BinkCommented:
Did you try setting a default document with DirectoryIndex?  How?  What happened?
0
 
Deepak KosarajuDevOps EngineerCommented:
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
 
Deepak KosarajuDevOps EngineerCommented:
Please check the directory permissions that other's have read access.
0
 
linuxpigAuthor Commented:
Permissions are nagios:nagios and 777 on /usr/local/nagios/share
0
 
Kerem ERSOYPresidentCommented:
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
 
linuxpigAuthor Commented:
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
 
Kerem ERSOYPresidentCommented:
ok did you restart your nagios service ?
0
 
Kerem ERSOYPresidentCommented:
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
 
caterham_wwwCommented:
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
 
linuxpigAuthor Commented:
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
 
Kerem ERSOYPresidentCommented:
@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
 
linuxpigAuthor Commented:
I tried this but not working, so i give up on this. I thank all for input!
0
 
slayerduckCommented:
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
 
slayerduckCommented:
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
 
linuxpigAuthor Commented:
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
 
nsikkandarCommented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 5
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now