I tried so many methods and get stick hours with this. I edit /etc/nginx/nginx.conf
and write these lines.
location /home/user/domains/example.com/public_html/lockfolder/ {
auth_basic "Restricted";
auth_basic_user_file /home/user/domains/example.com/.htpasswd;
}
and I use crypt(3)
encryption to make password with the command mkpasswd
. Then I did with the given procedure user:encryptedpasswd
in .htpasswd
.
But things does not work as said. Let me know if anyone know how I can exactly make configure for my purpose!
I also reload my nginx with /etc/init.d/nginx reload