Access Forbidden


#1

Hi All,
I am trying to install Nagios 3.2.0 on Suse Linux 10 SP2. When I try to access the web page I am getting Access forbidden error.

You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403
bominfnag0001
Thu Nov 26 12:48:46 2009
Apache/2.2.3 (Linux/SUSE)

My Apache Error Log file shows the below details

[Thu Nov 26 12:21:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:26:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:31:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:36:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:41:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:46:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:48:46 2009] [error] [client 10.174.51.205] Directory index forbidden by Options directive: /usr/local/nagios/share/
[Thu Nov 26 12:51:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 12:56:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/
[Thu Nov 26 13:01:07 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/

My /etc/apache2/conf.d/nagios.conf file reads as below

bominfnag0001:/etc/apache2/conf.d # cat nagios.conf

SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER

Last Modified: 11-26-2005

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
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

Alias /nagios “/usr/local/nagios/share”

<Directory “/usr/local/nagios/share”>

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 /usr/local/nagios/etc/htpasswd.users
Require valid-user


#2

something wrong with your apache config… the log talks about /srv/www/htdocs/ but the config says /usr/local/nagios/share

looks like your nagios config for apache isn’t being considered.


#3

How could I troubleshoot this. I am new to Linix and I am not sure about the config files for apache .


#4

did you follow these instructions (nagios.sourceforge.net/docs/3_0/ … nsuse.html) or something different?


#5

I have followed the same steps.


#6

try doing step 5 again.

after restarting apache check the apache log to see if there are some errors. your config file is being ignored for some reason by apache.

if this doesnt work check the file /etc/apache2/apache2.conf if there is the following line:

Include generic snippets of statements

Include /etc/apache2/conf.d/

check that line isn’t commented with a #


#7

I dont find a file /ete/apache2/apache2.conf. Anyhow I tried inserthing the line to httpd.conf file. When i try to restart the apache service I am geeting the below mentioned log

bominfnag0001:/etc/apache2 # rcapache2 restart
[Mon Nov 30 11:59:35 2009] [warn] The ScriptAlias directive in /etc/apache2/conf.d/nagios.conf at line 9 will probably never match because it overlaps an earlier ScriptAlias.
[Mon Nov 30 11:59:35 2009] [warn] The Alias directive in /etc/apache2/conf.d/nagios.conf at line 26 will probably never match because it overlaps an earlier Alias.
Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) [Mon Nov 30 11:59:35 2009] [warn] The ScriptAlias directive in /etc/apache2/conf.d/nagios.conf at line 9 will probably never match because it overlaps an earlier ScriptAlias.
[Mon Nov 30 11:59:35 2009] [warn] The Alias directive in /etc/apache2/conf.d/nagios.conf at line 26 will probably never match because it overlaps an earlier Alias.
done


#8

I ran into the exact same problem on SLES 10 SP2.

FIX: I Installed the PHP packages and the other web packages via Yast, Software, Software managment, Filter, Patterns,Web and LAMP Server and restarted apache and the web page came up fine.

Yast ended up installing all of the below packages. I really doubt you need mysql. I think the php5 and related packages are the important ones that made the difference. The php5 rpm also puts php5.conf in /etc/apache2/conf.d.
The Nagios quick start for OpenSuse needs to say that php5 is a required package.

php5-xmlreader-5.2.5-9.5
php5-tokenizer-5.2.5-9.5
php5-sqlite-5.2.5-9.5
php5-pdo-5.2.5-9.5
php5-json-5.2.5-9.5
php5-iconv-5.2.5-9.5
php5-dom-5.2.5-9.5
php5-ctype-5.2.5-9.5
mysql-5.0.26-12.18
php5-5.2.5-9.5
apache2-mod_php5-5.2.5-9.5
php5-timezonedb-2008.2-0.3
perl-DBD-mysql-3.0002-15.2
perl-Data-ShowTable-3.3-584.2
mysql-shared-5.0.26-12.18
mysql-client-5.0.26-12.18
mm-1.4.0-13.2
apache2-mod_python-3.1.3-60.9
apache2-example-pages-2.2.3-16.18
apache2-doc-2.2.3-16.18


#9

I just got off the phone with Nagios and they said that PHP was something new with Nagios and must have forgotten to update the OpenSuse section of the quick Start guides to state that PHP was needed. They did update the Fedora and Ubuntu sections to state that PHP was needed. They said that they’ll fix that and add PHP to the OpenSuse section of the next version of the Quickstart guide.