Allow only specific User?
February 22, 2017 03:53PM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready