I want to implement http auth if the password file exists for the user's home directory, if it doesn't exist then nginx should bypass the http auth. Following is in my vhost file.
location ~ ^/users/(.+?)(/.*)?$ {
include localhost.access;
auth_basic "Restricted";
auth_basic_user_file access.logins/$1;
alias /var/www/test/ssl/users/$1/ssl/$2;
autoindex on;
}
can't I have something like following check in my vhost file
if (-f access.logins/$1) {
auth_basic "Restricted";
auth_basic_user_file access.logins/$1;
}