Run this on the shell:
sudo sh -c "echo -n 'sammy:' >> /etc/nginx/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
Change nginx file to:
location / {
...
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}