Create a password file for Nginx basic authentication

It is really a hard time for me to find a way to create a password file for Nginx basic authentication, because I did not realise htpasswd crpty is not available on Windows.

Nginx documentation only mentions Use crypt(3) encryption for passwords, so I tried so hard with htpasswd.exe but could not generate a file recognised by Nginx. Hours later I found Apache documentation mentions -d is

the default on all platforms but Windows, Netware and TPF. Though possibly supported by htpasswd on all platforms, it is not supported by the httpd server on Windows, Netware and TPF.

I have two things to blame –

  1. I still use Windows to do my everyday work. If my first choice was htpasswd on Linux even without furthur instructions, it would have save me a lot of time.
  2. Nginx documentionation. If Nginx documentation is as good as Apache’s, Nginx may overwhelm the world.

Leave a comment

Your email address will not be published. Required fields are marked *