---
title: "Apache（六）Authentication Provider Aliases"
author: "mzl0517"
date: "2012-03-27T20:43:56Z"
tags: []
categories: ["开源软件"]
slug: "apache-authentication-provider-aliases"
draft: false
lastmod: "2012-03-27T21:03:06Z"
id: 1465407
url: "https://roteg.iteye.com/blog/1465407"
---

以下是一个简单的目录上下文配置

&lt;Directory /root/apache2/doc&gt;

AuthType Basic

AuthName Document

AuthUserFile /root/apache2/auth/passwd

Require user rote

&lt;/Directory&gt;

 

上面是通过AuthUserType指定的用户信息文件，还可通过下面两种方式设置授权，效果同上

 

一、用户文件

 

&lt;AuthnProviderAlias file pwdfile&gt;   

AuthUserFile /root/apache2/auth/passwd

&lt;/AuthnProviderAlias&gt;

 

&lt;Directory /root/apache2/doc&gt;

AuthType Basic

AuthName Document

AuthBasicProvider pwdfile

Require user rote

&lt;/Directory&gt;

 

 

二、LDAP

 

&lt;AuthnProviderAlias ldap ldap1&gt;

AuthLDAPBindDN cn=rote,o=ctx

AuthLDAPBindPassword 123

AuthLDAPURL ldap://ldap.host/o=ctx

&lt;/AuthProviderAlias&gt;

 

&lt;AuthnProviderAlias ldap ldap2&gt;

AuthLDAPBindDN cn=rote,o=dev

AuthLDAPBindPassword 123

AuthLDAPURL ldap://other.ldap.host/o=dev?cn

&lt;/AuthProviderAlias&gt;

 

&lt;Directory /webpages/secure&gt;

AuthBasicProvider ldap1 ldap2

AuthType Basic

AuthName LDAP

Require valid-user

&lt;/Directory&gt;