1. 安装windows openldap服务
2. 通过ldap admin连接
3. 添加新的OU和uid
nginx配置如下
ldap_server testldap {
#url ldap://192.168.137.1:389/dc=micmiu,dc=com?uid?sub?(&(objectClass=*));
url ldap://192.168.137.1:389/dc=micmiu,dc=com?uid?sub?(objectClass=*);
binddn "uid=Miumiu,ou=Tester,dc=micmiu,dc=com";
binddn_passwd "111111";
group_attribute memberuid;
group_attribute_is_dn on;
require valid_user;
}
server {
listen 8000;
server_name testldap_server;
location / {
root html;
index index.html index.htm;
auth_ldap "Forbidden";
auth_ldap_servers testldap;
}
}
之后再浏览器中输入用户名和密码: