HTTP auth basic directives

auth_basic_user_file directive

http, server, location, limit_except; path to a username/password-hash file. Keep outside served content and restrict permissions.

Formal Syntax & Structure

nginx syntaxnginx
auth_basic_user_file file;

Parameters & Attributes

NameTypeDescription
filepath expressionRead a protected credential-hash file outside the public document root; avoid plaintext and obsolete hash schemes.

Working Example

Example Snippetnginx
auth_basic_user_file /path/to/approved-password-file;
Nginx Reference