Welcome! Log In Create A New Profile

Advanced

auth_basic issue, won't protect full directory

Posted by haiku 
auth_basic issue, won't protect full directory
April 04, 2020 12:54PM
Hello,

I notice a big bug (or is it me) using nginx/1.16.1 (on Arch) and auth_basic which don't protect the whole directory using a simple

location /admin {
auth_basic "Restricted";
auth_basic_user_file /srv/http/admin/.htpasswd;
}

When i go to admin/index.php i got a auth request. But, if i have a admin/test.php file, i can request the file without any auth request.

What am i doing wrong ?
Bye
Re: auth_basic issue, won't protect full directory
April 04, 2020 02:03PM
https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-nginx-on-ubuntu-14-04

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: auth_basic issue, won't protect full directory
April 04, 2020 02:35PM
I try with same result

location /admin {
try_files $uri $uri/ =404;
auth_basic "Restricted";
auth_basic_user_file /srv/http/admin/.htpasswd;
}

Mind that i got auth request on admin/ not if i request a php file in it
Re: auth_basic issue, won't protect full directory
April 04, 2020 06:05PM
See the bottom (comments) of that article, your php block looks like it is not a part of the main location block.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: auth_basic issue, won't protect full directory
April 05, 2020 01:27AM
Thank you very much, i include a copy of the php block into the password protected one. all is ok thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 252
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready