htpasswd は、Apache のやつで作ります。
$ sudo htpasswd -c /opt/nginx/conf/htpasswd admin
あとは、/opt/nginx/conf/nginx.conf の server ブロックを以下のような感じで設定します。
...
http {
...
server {
listen 80;
server_name www.example.com;
root /home/foo/example/public;
location / {
passenger_enabled on;
auth_basic "Restricted";
auth_basic_user_file htpasswd;
}
}
...
}
...