I’ve gradually been moving away from Apache and lighttpd over to nginx. It’s easier to setup and a lot quicker as well.
One task I ran into was to add a user account to an htpasswd file. I’m a sucker for forgetting commands really quickly, so here’s a reference for how this is achieved:
printf "myusername:$(openssl passwd -crypt mypassword)\n" >> /etc/nginx/htpasswd
You shouldn’t even need to reload/restart nginx afterwards.