nginx auth

location / {
    auth_basic           "closed site";##Context:httpserverlocationlimit_except
    auth_basic_user_file conf/htpasswd;##Context:httpserverlocationlimit_except
}
# printf "howhy:$(openssl passwd -crypt 123456)\n" >>conf/htpasswd
# cat conf/htpasswd
howhy:xyJkVhXGAZ8tM
systemctl restart nginx
posted @ 2016-12-20 18:06  howhy  阅读(260)  评论(0编辑  收藏  举报