Creating an htpasswd file for NGINX

There is a python script available here that will create an htpasswd file. Here is how you configure the NGINX configuration file:

        location / {
               .............................
               auth_basic "Restricted";
               auth_basic_user_file /opt/nginx/conf/htpasswd;
               .............................
        }

Here is how you use the utility:

/opt/nginx/conf# htpasswd.py -c -b htpasswd username password

Just restart NGINX and you will get a basic authentication challenge.