Password protect a directory

Hello! I need to password protect a directory but everything that I try is not working - here is what I have in locations.conf:

location /secrets { auth_basic “Private”; auth_basic_user_file /var/www/domain.com/conf/htpasswd_secrets; allow 127.0.0.1; deny all; try_files $uri $uri/ $uri.php?$args; }

what do I need to add to this or edit to get it to work? Also, what’s the proper way to encrypt the password?

This is the latest but still not working - can anyone help?

location  /secrets {
    auth_basic            "Restricted";
    auth_basic_user_file  /var/www/domain.com/conf/htpasswd_secrets;
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi_params;
    access_log off;
    log_not_found off; }

I’ve also tried this with no luck:

location ^~ /secrets/ {
auth_basic            "Restricted";
auth_basic_user_file  /etc/nginx/htpass;

location ~ \.html {
    fastcgi_index index.html;
    fastcgi_split_path_info ^(.+\.html)(.*)$;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    #fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
}

}

Nobody has no idea?

Figured it out - no help needed