Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Allow only specific User?

$
0
0
I have htpasswd Authentication working for some directorys. In the htpasswd File, i have several Accounts. I want to use the same htpasswd File for all Directorys with the same file. But for some directorys, i want to allow only one specific User from this htpasswd file. But, if i use a construct like:

location ~ ^/somedir/ {
auth_basic "Restricted Directory";
auth_basic_user_file /etc/nginx/.htpasswd;

if ($remote_user != "adminuser")
{
return 403;
}
}

im allways denied to access the directory. No Credential Request is shown.

What can i do?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>