Knowledgebase

Nagios 403 error

Posted by LMWR, 05-10-2011, 11:16 PM
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 "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. I've also tried to add "index.php" to index string in nginx.conf, but after that I'm getting 404 error. What could be a problem? Here's my nginx.conf: 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; } }

Posted by david510, 05-11-2011, 12:11 AM
Can you make a test index.php(may be a phpinfo) file in the /usr/share/nagios3/htdocs/ folder and check whether you can access it?

Posted by quad3datwork, 05-11-2011, 01:48 AM
Is there a /usr/share/nagios3/htdocs/.htaccess file? Check who is allowed.

Posted by LMWR, 05-11-2011, 10:58 AM
I've made it in htdocs folder, but when I try to access it I can only "download" that file. I guess that's not right. However, we've got several php-heavy web-sites. They are working fine. There was no such file. Anyway, it didn't help.

Posted by barbus, 05-11-2011, 04:23 PM
Check nginx error logs.

Posted by LMWR, 05-11-2011, 05:03 PM
There is only 1 error: "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""

Posted by quad3datwork, 05-11-2011, 05:27 PM
Hows PHP configured? FastCGI?

Posted by LMWR, 05-11-2011, 05:50 PM
It's working via fcgi wrapper. I've used common method described here: articles.slicehost.com/2011/5/6/install-nagios3-on-debian-5-0-lenny

Posted by LMWR, 05-11-2011, 09:54 PM
OK, a little update. I've been reading through Internet and found out, that "403 error" usually occurs when nginx can't properly read password file (that is possible when password in such file is not properly encrypted). And one more strange thing. When I've changed the path to password file from: to: "Login loop" started(of course I've created that new "htpasswd.users" file before that). I can't authorize at all! I've tried to generate password using Apache's htpasswd util, but with no success. Can anyone shed more light on that?

Posted by LMWR, 05-12-2011, 12:06 PM
Thanks everybody for help. This issue was solved by moving "root" and "index" directives from "location" part to global. Now it's working as intended.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
help httpd load 300 (Views: 632)
Reseller? NOT! (Views: 567)


Language:

Client Login

Email

Password

Remember Me

Search