Reputation: 3
I'm using Nginx, trying to host a web server. This will only be for private use, so I want to protect it with a password. I am using auth_basic. This only seems to work when connecting to the server with the IP address. I have set up (or certbot has, to be exact) http:// to https:// redirect. If I try to access the site with the domain, I go straight through the authentication, no questions asked. If I use the IP, I will get prompted to enter credentials.
This is a virtual machine, running Ubuntu 18.04 64-bit, desktop edition (yes, I am a beginner so I use the desktop edition).
root /var/www/html;
auth_basic "Password protected site";
auth_basic_user_file /home/.htpasswd;
I am expecting every connection to be prompted to login or be abandoned, but it only asks for authentication when connecting with the server IP and http://.
Upvotes: 0
Views: 880
Reputation: 3
I figured it out, just needed to add the code block a second time to a lower part of the config.
Upvotes: 0