首页 > 代码库 > nginx auth

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

nginx auth