Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
05-10-2011, 05:58 PM
|
#1
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Rep:
|
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?
|
|
|
05-10-2011, 08:11 PM
|
#2
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Rep:
|
What do http logs say ?
|
|
|
05-10-2011, 09:20 PM
|
#3
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
Quote:
Originally Posted by vikas027
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.
|
|
|
05-10-2011, 09:32 PM
|
#4
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Rep:
|
Quote:
Originally Posted by LMW
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
|
|
|
05-10-2011, 09:44 PM
|
#5
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
Quote:
Originally Posted by vikas027
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"
|
|
|
|
05-10-2011, 09:52 PM
|
#6
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Rep:
|
Quote:
Originally Posted by LMW
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.
|
|
|
05-10-2011, 10:18 PM
|
#7
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
Quote:
Originally Posted by vikas027
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
|
|
|
05-11-2011, 02:26 AM
|
#8
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
Hi,
Open nginx.conf and add index.php in the index directive:
Code:
index index.html index.htm index.php;
Regards
|
|
|
05-11-2011, 11:23 AM
|
#9
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
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 =(
|
|
|
05-11-2011, 12:49 PM
|
#10
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
So, check the error.log to see what is not found and where it's looking for it.
|
|
|
05-11-2011, 01:44 PM
|
#11
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
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.
|
|
|
05-11-2011, 01:54 PM
|
#12
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
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.
|
|
|
05-11-2011, 02:14 PM
|
#13
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
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
|
|
|
05-11-2011, 02:30 PM
|
#14
|
Member
Registered: Oct 2010
Location: Russia / USA
Distribution: Arch Linux
Posts: 36
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
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"
|
|
|
|
05-11-2011, 02:57 PM
|
#15
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
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
|
|
|
All times are GMT -5. The time now is 12:39 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|