Debian 6.0
Sponsored Link

Basic Auth + LDAP2011/03/10

  Configure Apache2 and set a page that people must authenticate and the authentication is from LDAP server. Therefore it's necessarry to run LDAP server in your LAN.

[1] Following example shows 'test' directory requires an authentication.
a2enmod ldap authnz_ldap
# enable modules

Enabling module ldap.
Considering dependency ldap for authnz_ldap:
Module ldap already enabled
Enabling module authnz_ldap.
Run '/etc/init.d/apache2 restart' to activate new configuration!

vi /etc/apache2/conf.d/auth.conf

# create new

<IfModule authnz_ldap_module>
<Directory /var/www/test>


AuthName "Authentication"

AuthType Basic

AuthBasicProvider ldap

AuthLDAPURL ldap://,dc=world?uid?sub?(objectClass=*)

Require ldap-filter objectClass=posixAccount



/etc/init.d/apache2 restart

Restarting web server: apache2 ... waiting .

vi /var/www/test/index.html

# create a test page

<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for LDAP Auth
  Access to the test page with web browser, then authentication is required as a config. Input user name on LDAP and authenticate here.
  Just accessed
Matched Content