First thing you’ll need to do is to enable the needed mods, ldap.load & authnz_ldap.load These come preloaded with most linux, you’ll just need to enable them.
On Ubuntu:
Enable LDAP Authentication
cd /etc/apache2/mods-enabled ln -s ../mods-available/ldap.load ldap.load ln -s ../mods-available/authnz_ldap.load authnz_ldap.load apache2ctl graceful
.htaccess
You should now be able to implement the following wherever desired:
Example .htaccess file
Order deny,allow Deny from All AuthName "Restricted Page - login with LDAP credentials" AuthType Basic AuthBasicProvider ldap AuthzLDAPAuthoritative on AuthLDAPUrl ldap://ldap.example.com/ou=admins,o=LDAPROOT?adminUser AuthLDAPGroupAttribute memberUid AuthLDAPGroupAttributeIsDN off Require valid-user Satisfy any <Files .htaccess> order allow,deny deny from all </Files>
Note that ‘?adminUser’ on the end of the AuthLDAPUrl line is whatever object you use in your configuration.
Apache Config
/etc/apache2/sites-available/default
Make sure the following is set (the default is AllowOverride AuthConfig)
AllowOverride All