Nginx ngx_http_auth_basic_module (HTTP auth Basic module) configuration and parameter meanings.

Source: Internet
Author: User
Tags crypt http authentication

This module allows you to use the user name and password based on the Basic HTTP authentication method to protect your site or part of its content.

_ Instance configuration __:

location  /  {: auth_basic            "Restricted";: auth_basic_user_file  conf/htpasswd;}

Command
[# Auth_basic]
[# Auth_basic_user_file]

Auth_basic
Syntax: auth_basic [text | Off]

Default Value: auth_basic off

Scope: HTTP, server, location, limit_0000t

This command contains the test name and password used for basic HTTP authentication. The assigned parameters are used in the authentication field. The value "off" overwrites the inheritance of upper-level commands.

Auth_basic_user_file
Syntax: auth_basic_user_file the_file

Default Value: No

Scope: HTTP, server, location, limit_0000t

This command specifies the htpasswd file name for an authentication domain.

The file format is similar to the following:

User name: Password username 2: Password 2: Comment username 3: Password 3

 

The password must be encrypted using the function crypt (3. You can use the htpasswd tool from Apache to create a password file.

You can also use Perl to create a password file, PW. pl content:

#!/usr/bin/perluse strict;my $pw=$ARGV[0] ;print crypt($pw,$pw)."\n";

Then begin line:

chmod +x pw.pl./pw.pl passwordpapAq5PwY/QQM

Papaq5pwy/qqm is the password of crypt.

Reference
Original document: http://sysoev.ru/nginx/docs/http/ngx_http_auth_basic_module.html

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.