Welcome! Log In Create A New Profile

Advanced

nginx's auth for user's home directory

Posted by adeelarifbhatti 
nginx's auth for user's home directory
August 01, 2013 08:58AM
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;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 79
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready