LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-10-2011, 05:58 PM   #1
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Rep: Reputation: 2
Nagios 403 error


I have nagios + nginx running on Debian Lenny box. I've updated from nagios in Lenny repos to nagios in Squeeze repos. Everything was working before that. Now, when I try to access nagios on http://myserver/nagios3 I'm allowed to enter credentials, but after that I'm constantly getting "403 Forbidden" error.
nginx logs show: directory index of "/usr/share/nagios3/htdocs/" is forbidden, client: x.x.x.x, server: nagios3, request: "GET /nagios3/ HTTP/1.1", host: "x.x.x.x"
All permissions seem to be set OK. What could be a problem?
 
Old 05-10-2011, 08:11 PM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
What do http logs say ?
 
Old 05-10-2011, 09:20 PM   #3
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by vikas027 View Post
What do http logs say ?
I'm sorry, but what do you mean by "http logs"? I thought I've provided correct nginx log to reveal a problem.
 
Old 05-10-2011, 09:32 PM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by LMW View Post
I'm sorry, but what do you mean by "http logs"? I thought I've provided correct nginx log to reveal a problem.
Try this first.
Code:
chmod -R 777 /usr/share/nagios3/htdocs/
You can find httpd logs location as below
Code:
egrep 'ErrorLog|CustomLog' /etc/httpd/conf/httpd.conf | tail -2
 
Old 05-10-2011, 09:44 PM   #5
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by vikas027 View Post
Try this first.
Code:
chmod -R 777 /usr/share/nagios3/htdocs/
I've tried that already. No result.

You can find httpd logs location as below
Code:
egrep 'ErrorLog|CustomLog' /etc/httpd/conf/httpd.conf | tail -2
I don't have apache. Consequently, I don't have apache2.conf (httpd.conf). Instead, I'm running nginx web-server and it's error log shows always the same line:
Quote:
[error] 28441#0: *8 directory index of "/usr/share/nagios3/htdocs/" is forbidden, client: x.x.x.x, server: nagios3, request: "GET /nagios3/ HTTP/1.1", host: "x.x.x.x"
 
Old 05-10-2011, 09:52 PM   #6
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by LMW View Post
I don't have apache.
Apologies, I should have seen that.

Did you tried the below command, restart nginx web-server services and try.
Code:
chmod -R 777 /usr/share/nagios3/htdocs/
I am no expert in this, just trying to help you out.
 
Old 05-10-2011, 10:18 PM   #7
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by vikas027 View Post
Apologies, I should have seen that.

Did you tried the below command, restart nginx web-server services and try.
Code:
chmod -R 777 /usr/share/nagios3/htdocs/


I am no expert in this, just trying to help you out.
Yes, I've tried that before, but with no result. Anyway, thank you
 
Old 05-11-2011, 02:26 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
Hi,

Open nginx.conf and add index.php in the index directive:
Code:
index  index.html index.htm index.php;
Regards
 
Old 05-11-2011, 11:23 AM   #9
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by bathory View Post
Hi,

Open nginx.conf and add index.php in the index directive:
Code:
index  index.html index.htm index.php;
Regards
That throws "404 Not Found" error =(
 
Old 05-11-2011, 12:49 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
So, check the error.log to see what is not found and where it's looking for it.
 
Old 05-11-2011, 01:44 PM   #11
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by bathory View Post
So, check the error.log to see what is not found and where it's looking for it.
*51 open() "/usr/share/nagios3/htdocs/nagios3" failed (2: No such file or directory), client: x.x.x.x, server: nagios3, request: "GET /nagios3 HTTP/1.1", host: "x.x.x.x"

My nginx.conf is:

server {
listen x.x.x.x:80;
server_name nagios3;

access_log /var/log/nginx/nagios_access.log;

location /nagios3/ {
root /usr/share/nagios3/htdocs;
index index.html index.php;
rewrite ^/nagios3/(.*)$ /$1 break;

auth_basic "Nagios login";
auth_basic_user_file /etc/nagios3/conf.d/htpasswd;
}

location /nagios3/stylesheets {
alias /etc/nagios3/stylesheets;

}

location ~ \.cgi$ {
root /usr/lib/cgi-bin/nagios3;
rewrite ^/cgi-bin/nagios3/(.*)$ /$1;

include /usr/local/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:8999;
fastcgi_param SERVER_PORT 80;
fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/nagios3$fastcgi_script_name;
auth_basic "Nagios login";
auth_basic_user_file /etc/nagios3/conf.d/htpasswd;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}
}

Last edited by LMW; 05-11-2011 at 01:48 PM.
 
Old 05-11-2011, 01:54 PM   #12
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
When I change location string to just "/", I'm advised to download "download.html", which contains:

Quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<title>Nagios</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/ico">
</head>

<frameset cols="180,*">
<frame src="side.php" name="side" frameborder="0">
<frame src="main.php" name="main" frameborder="0">

<noframes>
<!-- This page requires a web browser which supports frames. -->
<h2>Nagios</h2>
<p align="center">
<a href="http://www.nagios.org/">www.nagios.org</a><br>
Copyright (c) 1999-2009 Ethan Galstad<br>
</p>
<p>
<i>Note: These pages require a browser which supports frames</i>
</p>
</noframes>

</frameset>

</html>

Last edited by LMW; 05-11-2011 at 01:55 PM.
 
Old 05-11-2011, 02:14 PM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
I think you need to use alias instead of root
Code:
server {
listen x.x.x.x:80;
server_name nagios3;

access_log /var/log/nginx/nagios_access.log;

location /nagios3/ {
alias /usr/share/nagios3/htdocs/;
index index.html index.php;
<snip>
And mind the trailing slash after htdocs.

Regards
 
Old 05-11-2011, 02:30 PM   #14
LMW
Member
 
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by bathory View Post
I think you need to use alias instead of root
Code:
server {
listen x.x.x.x:80;
server_name nagios3;

access_log /var/log/nginx/nagios_access.log;

location /nagios3/ {
alias /usr/share/nagios3/htdocs/;
index index.html index.php;
<snip>
And mind the trailing slash after htdocs.

Regards
New day, new error

Quote:
*52 "alias" could not be used in location "/nagios3/" where URI was rewritten, client: x.x.x.x, server: nagios3, request: "GET /nagios3/ HTTP/1.1", host: "x.x.x.x"
 
Old 05-11-2011, 02:57 PM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
What does this rewrite do anyway?
Could you comment it out and see if it works?
You can also take a look at this howto for more configuration details on debian
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios 403 Forbidden error in monitoring localhost mtimbro Linux - Software 4 06-12-2008 02:42 PM
Apache, nagios and 403 forbidden gfem Fedora 1 10-04-2007 03:43 PM
Mysterious 403 error intramaweb Linux - Software 4 06-01-2006 06:42 PM
can't get anything but error 403 kuplo Linux - Software 2 11-02-2005 11:11 AM
Nagios (403 Error) cuiguy Linux - Software 1 04-05-2005 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration