i have 2 folders: /protected and /admin
inside the htpasswd i have multiple users and the one named "admin"
how do i setup so that all the users with admin can access the /protected folder but only admin can access the /admin folder?
location /protected {
auth_basic "Protected Area";
auth_basic_user_file .htpasswd;
root /static;
autoindex_exact_size off;
autoindex on;
}
location /admin {
auth_basic "Restricted Area";
auth_basic_user_file .htpasswd;
set $is_admin 0;
if ($remote_user = "admin") {
set $is_admin 1;
}
if ($is_admin = 0) {
return 403;
}
root /static;
autoindex_exact_size off;
autoindex on;
}
location / {
root /static;
autoindex_exact_size off;
autoindex on;
}