ArchLinux – WordPress 結合 LDAP

參考網頁:
wordpress 和 LDAP 的結合(TLS) | 資訊雜記

安裝 php-ldap
# pacman -S php-ldap

開啟 php ldap 功能
# sed -i ‘s/;extension=ldap.so/extension=ldap.so/’ /etc/php/php.ini

重新啟動 php-fpm
# systemctl restart php-fpm[@more@]下載 WordPress LDAP 外掛程式
wpDirAuth:https://wordpress.org/plugins/wpdirauth/installation/

下載 wpDirAuth
# wget https://downloads.wordpress.org/plugin/wpdirauth.1.7.6.zip

解壓縮到 /srv/http/wordpress/wp-content/plugins 目錄
# unzip wpdirauth.1.7.6.zip -d /srv/http/wordpress/wp-content/plugins

啟用 wpDirAuth 外掛
登入後,選擇 網誌管理

選擇 外掛 / 已安裝外掛

選擇 wuDirAuth 的啟用

已啟用

選擇 設定 / Directory Auth

LDAP 設定相關參數

做以下的設定
1. Enable Directory Authentication?
2. Directory Servers (Domain Controllers)
3. Account Filter

1. Base DN
2. Bind DN
3. Bind Password
4. Confirm Password

Update Options

測試一下

可以正常登入

Wordress 更換 IP 之後

因為 WordPress 在安裝時會把網路的設定寫入到資料庫,所以當更換 IP 時,就會有無法連線的問題。

[@more@]解決方法:
參考網頁:
wordpress 修改IP地址后进不去后台的解决方法_wordpress_新浪轻博客
1. 使用 SQL 指令 紅色的 IP 就是新的 IP
# /usr/bin/mysql -u root -p wordpress
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 16
Server version: 10.0.14-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

MariaDB [wordpress]> update wp_options set option_value = ‘http://192.168.1.109/wordpress’ where option_name = ‘siteurl’ or option_name = ‘home’;
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

MariaDB [wordpress]> quit
Bye2. 使用 Script   紅字部分代表是 root SQL 的密碼
# vim /usr/local/bin/setwordpressip
#! /bin/bash
# set wordpress admin ip

param=$#

if [ $param -eq 1 ]; then
     echo “update wp_options set option_value = ‘http://”$1″/wordpress’ where option_name = ‘siteurl’ or option_name = ‘home’;” > setwordpress.tmp
     mysql -uroot -p123456 wordpress < setwordpress.tmp
     rm setwordpress.tmp
     echo “OK…”
     exit 0
fi

echo “use: $0 IP Address (127.0.0.1)”

更改權限
# chmod 700 /usr/local/bin/setwordpressip

使用方式
# /usr/local/bin/setwordpressip 192.168.1.109

ArchLinux – 安裝 WordPress

WordPress › Taiwan 正體中文網站:https://tw.wordpress.org/

下載 WordPress
# wget https://tw.wordpress.org/wordpress-4.0-zh_TW.tar.gz

解壓縮
# tar xvzf wordpress-4.0-zh_TW.tar.gz -C /srv/http

也可以直接使用 ArchLinux 內建的套件來安裝
# pacman -Ss wordpress
community/wordpress 4.0-1
    Blog tool and publishing platform
# pacman -S wordpress

建立資料庫 wordpress
# /usr/bin/mysqladmin -u root -p create wordpress
Enter password:[@more@]

開啟瀏覽器在網址列輸入 http://Server’IP/wordpress,然後選擇 衝吧!

資料庫設定

 在 /srv/http/wordpress 目錄下建立 wp-config.php 設定檔
# vim /srv/http/wordpress/wp-config.php

設定管理者資訊

安裝完成

登入網站

登入成功