Nginx Module Reference manual: HTTP Basic Authentication Module (HTTP Auth Basic)

Source: Internet
Author: User
Keywords Http basic auth nginx reference Manual HTTP Basic authentication module
Tags apache authentication based basic compiled configure default default value

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.