These modules are all compiled into Nginx by default unless a module is manually specified to be excluded in configure.
This module provides authentication based on user name and password to protect part of your site or site. The following example:
Location/{auth_basic "restricted"; Auth_basic_user_file conf/htpasswd;}
Instructions
Auth_basic
Syntax: Auth_basic [Text|off]
Default value: Auth_basic off
Working with fields: HTTP, server, location, limit_except
Variables: None
The instruction contains an HTTP Basic authentication with the test username and password, and the specified parameters are used for the authentication domain. If the value is set to off, the actions inherited by the subordinate instruction are ignored.
Auth_basic_user_file
Syntax: Auth_basic_user_file the_file
Default value: No
Working with fields: HTTP, server, location, limit_except
Variables: None
directive specifies the password file for the authentication domain, after 0.6.7 The file specified here is the relative path of the nginx.conf directory, not the path specified by –prefix.
This file format is as follows:
User:passuser2:pass2:commentuser3:pass3
If Apache is not installed, the password field must be crypt (3) function encryption, if you have Apache installed, you can use Apache HTPASSWD program to generate a password, note: Apache use MD5 encryption.