I want to password protect my developer subdomain (dev.example.com), and leave the main domain publicly available.
I want to do this recursively, so that any file or folder on the subdomain will always prompt you for a login.
In the Nginx config file, I've added the following to my dev.example.com server-block (note that I have separate server-blocks for the main and subdomain):
location ^~ / {
auth_basic "Administrator Login";
auth_basic_user_file /home/path/to/.htpasswd;
}
From searching around on SF, I was under the impression that the ^~
identifier makes the password protection recursive, but it doesn't.
While dev.example.com specifically prompts me for a login, dev.example.com/folder/ doesn't.
What am I doing wrong?