map $remote_user $profile_directory {
default $remote_user;
'' guests;
pavel admins;
ivan admins;
}
server {
location /profile/ {
alias /path/to/www/$profile_directory/;
...
}
}
segundo exemplo (ver comentários):
server {
location / {
auth_basic "Please Login";
auth_basic_user_file "/etc/nginx/htpasswd";
root /var/www/sites/mysite.com/http/$remote_user;
}
}