在nginx上使用basic authentication



创建密码文件 .htpasswd

1
2
3
4
htpasswd -c /etc/nginx/.htpasswd guest
New password:
Re-type new password:
Adding password for user guest

添加用户

1
htpasswd /etc/nginx/.htpasswd guest-02

在nginx上配置 HTTP Basic Authentication

1
2
3
4
location /status {                                       
    auth_basic           “Administrator’s Area”;
    auth_basic_user_file /etc/nginx/.htpasswd; 
}