?
## apache通過AD驗證
#yum install httpd mod_authz_ldap
#安裝apahce的ldap模塊
yum install mod_authz_ldap -y
#配置apache通過ldap進行認證
cp /etc/httpd/conf.d/authz_ldap.conf /etc/httpd/conf.d/authz_ldap.conf.bak$(date +%F)
egrep -v "#|^$" /etc/httpd/conf.d/authz_ldap.conf
#編輯配置
vim /etc/httpd/conf.d/authz_ldap.conf
LoadModule authz_ldap_module modules/mod_authz_ldap.so
<IfModule mod_authz_ldap.c>
#配置AD 的IP地址,認證用戶、密碼等
<Directory /var/www/html/ldap> #這里定義那個目錄需要使用ldap模塊認證 AuthzLDAPMethod ldap AuthzLDAPAuthoritative on AuthzLDAPServer 172.16.33.18 AuthzLDAPUserBase "OU=Tech,OU=users,DC=test,DC=cn" AuthzLDAPUserKey sAMAccountName AuthzLDAPUserScope subtree AuthzLDAPBindDN "elven@test.cn" AuthzLDAPBindPassword "test" AuthType Basic AuthName "Test ldap" require valid-user </Directory></IfModule>
?
apache ab?#啟動
echo ServerName localhost:80 >>/etc/httpd/conf/httpd.conf #添加本機web 80端口
service httpd start
chkconfig --add httpd
chkconfig httpd on
#測試目錄
mkdir /var/www/html/ldap
echo "LDAP test">/var/www/html/ldap/index.html
#瀏覽器http://ip/ldap