-2

I have followed this link to install nagios, I already have nginx up and running. The problem is I keep getting user name and password to authenticate.

When I remove the auth_basic_user_file /etc/nagios/htpasswd.users;, I don't get that alert again. But the http://localhost/nagios gives me blank page. Then when I use get that line back, I can't access it. I even tried chown nagios /etc/nagios/htpasswd.users as solution in this thread.

Here are my files

htpasswd.users

yamen:NFy9PslWPh4Vo

mywebsite

   server {
            server_name *********************************;
            access_log /var/log/nginx/access.log;
            error_log /var/log/nginx/error.log;
            auth_basic      "Yamen's Area!";
            auth_basic_user_file  /etc/nagios/htpasswd.users;
            root /home/yamen/repos/autoban-md/;
            index index.php index.html index.htm;
            #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            location / {
                    try_files $uri $uri/ /index.php;
            }
            location /nagios {
                    alias /opt/nagios/nagios/share;
            }
            location ~ ^/nagios/(.*\.php)$ {
                    alias /opt/nagios/nagios/share/$1;
                    include /etc/nginx/fastcgi_params;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
            }
            location ~ \.cgi$ {
                    root /opt/nagios/nagios/sbin/;
                    rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
                    fastcgi_param AUTH_USER $remote_user;
                    fastcgi_param REMOTE_USER $remote_user;
                    include /etc/nginx/fastcgi_params;
                    fastcgi_pass unix:/var/run/fcgiwrap.socket;
            }
            error_page 404 /404.html;
            error_page 500 502 503 504 /50x.html;
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            location ~\.php$ {
                    try_files $uri =404;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                    fastcgi_index  index.php;
                    include fastcgi_params;
            }
            location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
                    add_header "" "";
            }
            location ~ "^/pagespeed_static/" { }
            location ~ "^/ngx_pagespeed_beacon$" { }
    }

The nagios.conf doesn't provide any thing.

I put the above user name and pass again and again nothing happened

Thanks to @PaulHaldane, I did found the error but still cant know why it happens. Here is nginx error log.

*108 user "yamen": password mismatch, client: 127.0.0.1, server: *************
1
  • Does anything appear in the nginx error log (/var/log/nginx/error.log) when you try to access the page? If it does please paste the relevant lines into your question. Dec 21, 2014 at 11:42

1 Answer 1

0

the problem was i changed the htpasswd.users manually. so after running

htpasswd.py -c -b /etc/nagios/htpasswd.users yamen yamen

the problem gone :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .