How to Set Up Password Authentication With Nginx on Ubuntu 14.04 | DigitalOcean

sudo sh -c "echo -n ‘sammy:’ >> /etc/nginx/.htpasswd"Next, add an encrypted password entry for the username by typing:sudo sh -c “openssl passwd -apr1 >> /etc/nginx/.htpasswd”

来源: How To Set Up Password Authentication with Nginx on Ubuntu 14.04 | DigitalOcean