Does nginx auth_basic work over HTTPS?
Posted
by
monde_
on Server Fault
See other posts from Server Fault
or by monde_
Published on 2011-11-26T09:18:29Z
Indexed on
2011/11/26
9:57 UTC
Read the original article
Hit count: 198
I've been trying to setup a password protected directory in a SSL website as follows:
/etc/nginx/sites-available/default
server {
listen 443:
ssl on;
ssl_certificate /usr/certs/server.crt;
ssl_certificate_key /usr/certs/server.key;
server_name server1.example.com;
root /var/www/example.com/htdocs/;
index index.html;
location /secure/ {
auth_basic "Restricted";
auth_basic_user_file /var/www/example.com/.htpasswd;
}
}
The problem is when I try to access the URL https://server1.example.com/secure/
, I get a "404: Not Found" error page.
My error.log shows the following error:
011/11/26 03:09:06 [error] 10913#0: *1 no user/password was provided for basic authentication,
client: 192.168.0.24, server: server1.example.com, request: "GET /secure/ HTTP/1.1",
host: "server1.example.com"
However, I was able to setup password protected directories for a normal HTTP virtual host without any problems.
Is it a problem with the config or something else?
© Server Fault or respective owner