① 安装和配置httpd
yum -y install httpd
rm -f /etc/httpd/conf.d/welcome.conf
vim /etc/httpd/conf/httpd.conf //修改下面几行内容
ServerName www.example.com:80 //第96行
AllowOverride All //第151行
DirectoryIndex index.html index.cgi index.php //第164行
# add follows to the end //添加这几行
# server's response header
ServerTokens Prod
# keepalive is ON
KeepAlive On
systemctl start httpd
systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
vim /var/www/html/index.html
this is test page for httpd!!!
访问http://10.5.10.141/
② 安装php
yum -y install php php-mbstring php-pear
vim /etc/php.ini
date.timezone = "Asia/Shanghai" //第878行
systemctl restart httpd
vim /var/www/html/index.php
<?php
phpinfo();
?>
访问http://10.5.10.141/index.php
③ yum install phpldapadmin
④ 配置phpLDAPadmin
配置/etc/httpd/conf.d/phpldapadmin.conf允许从远程访问
第一处修改
vi /etc/httpd/conf.d/phpldapadmin.conf
Alias /phpldapadmin /usr/share/phpldapadmin/htdocs
Alias /ldapadmin /usr/share/phpldapadmin/htdocs
<Directory /usr/share/phpldapadmin/htdocs>
<IfModule mod_authz_core.c>
# Apache 2.4
Require local
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
修改为
Alias /phpldapadmin /usr/share/phpldapadmin/htdocs
Alias /ldapadmin /usr/share/phpldapadmin/htdocs
<Directory /usr/share/phpldapadmin/htdocs>
Order Deny,Allow
Allow from all
</Directory>
第二处修改Apache主配置文件httpd.conf
vi /etc/httpd/conf/httpd.conf
102 #<Directory />
103 # AllowOverride none
104 # Require all denied
105 #</Directory>
106
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
注释掉102-105添加107-110
不然会报错
Forbidden
You don't have permission to access /phpldapadmin/ on this server.
修改/etc/phpldapadmin/config.php配置用DN登录
vi /etc/phpldapadmin/config.php
$servers->setValue('login','attr','dn');
// $servers->setValue('login','attr','uid');
⑤ 然后重启服务
systemctl restart httpd
查看状态
service httpd status
页面登陆
http://10.5.10.141/ldapadmin
登录LDAP
DN填写:cn=Manager,dc=benmutest,dc=com
密码:admin
http://10.5.10.141/ldapadmin/cmd.php?server_id=1&redirect=true