Score:0

How to add in one .htpasswd file in nginx access to two different domain?

br flag

How I can add to /etc/nginx/.htpasswd access for two difference domain for two difference login and password?

Score:1
jp flag

If both the domains should have the same logins and passwords, simply add the auth_basic_user_file directive to both server{} blocks. If you require separate lists of users, you would also need separate credential files, as explained in the answer from Tero Kilkanen.

All you need is also explained in the Nginx Admin Guide: Restricting Access with HTTP Basic Authentication.

Score:1
us flag

If you want that credentials for domain A do not work for domain B and vice versa, then you cannot do it with a single .htpasswd file.

All the credentials in single .htpasswd file are valid for all domains where auth_basic_user_file is set to use that file.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.