Nginx Htpasswd Directory

 

Hi,

 

Are you using Nginx and searching for an alternative for htpasswd.?.  Here you go, all you need to do is add the below lines in your virtual host configuration file.

 

location ~ /downloads {
root /path/to/reach/downloads/directory/;
autoindex on;
auth_basic "Restricted";
auth_basic_user_file /path/to/your/htpass/file;
}

 

If you are not sure how to create a htpasswd file for Nginx use the below command.

 

htpasswd -c htpass <username> <password>

 

Thank you for viewing helpinlinux.com

One comment

Leave a Reply

Protected by WP Anti Spam