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

Leave a Reply

Your email address will not be published.

* Copy This Password *

* Type Or Paste Password Here *

30,132 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Protected by WP Anti Spam