Creating .htpasswd entries
An .htpasswd file holds user:hash lines for HTTP basic authentication in Apache and Nginx. This generator hashes the password in your browser (apr1-MD5 or SHA-1) and outputs a line you can append to the file.
Frequently asked questions
How do I protect a location in Nginx?
Add auth_basic "Restricted"; and auth_basic_user_file /etc/nginx/.htpasswd; inside the location block, then reload Nginx. Always serve basic-auth pages over HTTPS.
How do I create the file on the server instead?
htpasswd -c /etc/nginx/.htpasswd alice (from apache2-utils or httpd-tools). Omit -c when adding further users, or the file is overwritten.