2.3 Config Web Server
nano phpinfo.php
Vào http://172.16.1.40/svuit/php.info xem thông tin PHP
Mặc định gói php5-ldap chưa được cài…
Cài gói php5-ldap
[TABLE="class: grid, width: 800"]
[TR]
[TD]root@lamp www/svuit# apt-get install
php5-ldap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libapache2-mod-php5 lsof php5-cli php5-common php5-mcrypt php5-mysql
The following NEW packages will be installed:
lsof php5-ldap
The following packages will be upgraded:
libapache2-mod-php5 php5-cli php5-common php5-mcrypt php5-mysql
5 upgraded, 2 newly installed, 0 to remove and 12 not upgraded.
Need to get 6261 kB of archives.
After this operation, 552 kB of additional disk space will be used.
Do you want to continue [
Y/n]?[/TD]
[/TR]
[/TABLE]
[TABLE="class: grid, width: 800"]
[TR]
[TD]root@lamp www/svuit#
service apache2 restart
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
ok[/TD]
[/TR]
[/TABLE]
[TABLE="class: grid, width: 800"]
[TR]
[TD]root@lamp www/svuit# dpkg --get-selections | grep
ldap
libaprutil1-ldap install
libldap-2.4-2:amd64 install
php5-ldap install[/TD]
[/TR]
[/TABLE]
Cài gói php-codesnifferCài gói này để giúp tương thích giữa các phiên bản php…
[TABLE="class: grid, width: 800"]
[TR]
[TD]root@lamp www/svuit# apt-get install
php-codesniffer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
pear-phpunit-channel php-timer php5
The following NEW packages will be installed:
pear-phpunit-channel php-codesniffer php-timer php5
0 upgraded, 4 newly installed, 0 to remove and 12 not upgraded.
Need to get 467 kB of archives.
After this operation, 3507 kB of additional disk space will be used.
Do you want to continue [
Y/n]?[/TD]
[/TR]
[/TABLE]
Liệt kê các mod đã enable
[TABLE="class: grid, width: 800"]
[TR]
[TD]root@lamp www/svuit# ls /etc/apache2/mods-enabled
alias.conf authz_default.load autoindex.conf deflate.load mime.conf perl.load reqtimeout.conf ssl.conf
alias.load authz_groupfile.load autoindex.load dir.conf mime.load php5.conf reqtimeout.load ssl.load
auth_basic.load authz_host.load cgi.load dir.load negotiation.conf php5.load setenvif.conf status.conf
authn_file.load authz_user.load deflate.conf env.load negotiation.load python.load setenvif.load status.load[/TD]
[/TR]
[TR]
[TD]Nếu như mode
authnz_ldap đã được enable
root@wordpress ~# ls /etc/apache2/mods-enabled | grep ldap
authnz_ldap.load
ldap.conf
ldap.load
root@wordpress ~#[/TD]
[/TR]
[/TABLE]
ENABLE mod ldap và authnz_ldap
[TABLE="class: grid, width: 800"]
[TR]
[TD]a2enmod
authnz_ldap
a2enmod
ldap
/etc/init.d/apache2 restart[/TD]
[/TR]
[TR]
[TD]root@lamp www/svuit# a2enmod
authnz_ldap
Considering dependency ldap for authnz_ldap:
Enabling module ldap.
Enabling module authnz_ldap.
To activate the new configuration, you need to run:
service apache2 restart
root@lamp www/svuit# a2enmod
ldap
Module ldap already enabled
root@lamp www/svuit# /etc/init.d/apache2 restart
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
. ok
Lưu ý: bạn cũng có thể chạy lệnh a2enmod
ldap authnz_ldap để enable cùng lúc 2 mode
[/TD]
[/TR]
[TR]
[TD]Kiểm tra lại, bảo đảm 2 mode đã được enable
root@lamp www/svuit# ls /etc/apache2/mods-enabled | grep
ldap
authnz_ldap.load
ldap.conf
ldap.load
root@lamp www/svuit#[/TD]
[/TR]
[/TABLE]
Edit file /etc/hostsLưu ý: webserver phải phân giải được domain svuit.com thì mới có thể xác thực được ldap
[TABLE="class: grid, width: 800"]
[TR]
[TD]Kiểm tra bảm đảm phân giải được domain svuit.com
root@lamp www/svuit# ping
svuit.com
PING svuit.com (172.16.1.200) 56(84) bytes of data.
64 bytes from
svuit.com (172.16.1.200): icmp_req=1 ttl=128 time=1.23 ms
64 bytes from
svuit.com (172.16.1.200): icmp_req=2 ttl=128 time=0.316 ms
64 bytes from
svuit.com (172.16.1.200): icmp_req=3 ttl=128 time=1.03 ms
64 bytes from
svuit.com (172.16.1.200): icmp_req=4 ttl=128 time=0.326 ms[/TD]
[/TR]
[/TABLE]