HTTP - authorization setting on the site

We don't use Apache, so it is necessary to set HTTP - authorization in Nginx. Config Nginx can be edited via "Nginx editor". For activation of HTTP - authorization, it is necessary to add the following lines to the needed block "location":

auth_basic           "closed site";
auth_basic_user_file {path to .htpasswd};

Where,

Config example:

location / {
  auth_basic "closed site";
  auth_basic_user_file /home/{username}/domains/{parent_domain}/.htpasswd;
}