Solved How to create htpasswd user in Nginx

Hello,

In Apache, I used to run the following command to create my authentication files: htpasswd -c /var/www/mondomaine.com/config/htpasswd user1.

htpasswd being an Apache module, I wonder if someone could tell me how I can achieve the same outcome in Nginx?

Do I need to install apache2-utils modules?

Any help is greatly appreciated.

Thank you
Fred
 
Sorry but could you tell me why I get an error message "Illegal variable name" when I try any of the 4 example on the page?
Code:
webadmin@FreeBSD/home/www/public% ( PASSWORD="SEcRe7PwD" ; SALT="$(openssl rand -base64 3)" ; SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | sed 's#$#'"$SALT"'#' | base64 ) ; printf "Jim:{SSHA}$SHA1\n" >> .htpasswd )
Code:
Illegal variable name.
 
Probably because the example uses bash/sh syntax and you're on tcsh or csh.
 
openssl passwd -apr1 is my method of doing it. Take the hash that that command produces and add the username in front of it separated by a colon. It's a better hash format than crypt too.
 
Back
Top