我已经按照这个链接安装了 nagios,我已经启动并运行了 nginx。问题是我不断获取用户名和密码来进行身份验证。
当我删除 时auth_basic_user_file /etc/nagios/htpasswd.users;
,我不会再收到该警报。但是这http://localhost/nagios
给了我空白页。然后,当我使用 get that line back 时,我无法访问它。我什至尝试在这个线程中chown nagios /etc/nagios/htpasswd.users
作为解决方案。
这是我的文件
htpasswd.users
yamen:NFy9PslWPh4Vo
我的网站
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$" { }
}
nagios.conf
不提供任何东西。
我把上面的用户名,一遍遍的通过,什么都没发生
感谢@PaulHaldane,我确实发现了错误,但仍然不知道为什么会发生。这是 nginx 错误日志。
*108 user "yamen": password mismatch, client: 127.0.0.1, server: *************
问题是我手动更改了 htpasswd.users。所以运行后
问题消失了:)