我试图保护对M/Monit网络接口的访问:
盒:
ubuntu 14.04
nginx 1.8.1
mmonit-3.5.1
我在/etc/nginx/sites-available下创建了一个mmonit配置文件
server {
listen 8080;
root /var/www/html;
location / {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location ~ /\.ht {
deny all;
}
}它不显示身份验证对话框。我跟踪了serverfault-Nginx Password Protect Entire Port Number 8081,但似乎我做错了什么.我对nginx并不熟悉。
有人知道怎么做吗?它应该在同一个default服务器配置文件中吗?干杯
发布于 2016-02-11 11:58:16
所以我想出来了..。
(这是在默认服务器配置下)
root /var/www/html/;
server_name localhost;
location /mmonit/ {
proxy_pass http://yourServerIp:8080/;
auth_basic "Restricted Content";
auth_basic_user_file /path/to/your/password/file/;
index index.csp;
}ln -s /path/to/your/mmonit/folder/ /var/www/html/
给予:mmonit -> /path/to/your/mmonit/folder/
现在将浏览器指向:http://yourServerIp/mmonit/
您将拥有“身份验证所需”对话框!
A username and password are being requested by http://yourServerIp. The site says: "Restricted Content"
**我确实建议把这个链接称为其他的东西,然后是mmonit....to你的选择。
任何途径你的访问现在都是双重保护!
https://stackoverflow.com/questions/35242731
复制相似问题