2016年5月18日 星期三

第8章WordPress

8WordPress




8-1 簡介
8-2 安裝
8-3 新增別名、資料庫
8-3-1新增別名
8-3-2新增資料庫
8-4 網頁登入
8-4-1網頁安裝步驟
8-4-2首次登入
8-4-3LDAP登入設定
8-5 LDAP用戶登入
8-6參考文獻


8-1 簡介

  WordPress 是一套 PHP 開發的個人部落格 (Blog) 的系統,它強調網頁標準,美觀及可用性,使用者可以很方便的在管理平台上撰寫文章,並快速變更部落格的佈置主題、語言及其他設定。

  部落格作者可以建立密碼來保護文章,因此該文章只讓擁有密碼的讀者閱讀。除此之外還有很多的外掛模組來增強 WordPress 的功能,讓作者在寫作部落格時更加方便。

8-2 安裝

方式一:(使用ports
# cd /usr/ports/www/wordpress
# make config ; make install clean

方式二:(使用 pkg
# pkg install WordPress

‧略‧
New packages to be INSTALLED:
        wordpress: 4.5.2,1
        php56-curl: 5.6.21
        curl: 7.48.0_1
        php56-ftp: 5.6.21
‧略‧
Proceed with this action? [y/N]: y
‧略‧
Before the first use of WordPress, copy wp-config-sample.php to wp-config.php
in /usr/local/www/wordpress and modify it to fit your MySQL.
Maybe you need 'mysqladmin create wordpress' first.
If you are upgrading from 1.x or 2.x or 3.x to 4.x, please run
http://your.site/wordpress/wp-admin/upgrade.php to upgrade to WordPress 4.x
#

方式三:(下載 .zip 或 .tar.gz)至 /tmp 資料夾
root@f40:/tmp # unzip wordpress-4.5.2-zh_TW.zip

# mv wordpress /usr/local/www/

8-3 組態設定、調整、新增資料庫

8-3-1 新增別名
# ee /usr/local/etc/apache24/Includes/wordpress.conf

Alias /wordpress/ "/usr/local/www/wordpress/"
 <Directory "/usr/local/www/wordpress/">
    Options none
    AllowOverride none

    Require all granted
 </Directory>

# /usr/local/etc/rc.d/apache24 restart

8-3-2 新增資料庫
# mysql -u root -p
mysql> create database wordpress;
mysql> grant all on wordpress.* to wordpress@localhost identified by '********';
mysql> quit

8-4 網頁登入(中文化調整、LDAP登入設定)

8-4-1網頁安裝步驟

登入:
https://f40.testbsd.com/wordpress/

首次登入,尚無設定檔,會自動轉至下列網址:
https://f40.testbsd.com/wordpress/wp-admin/setup-config.php


【圖8-4-1-1

輸入資料庫等相關資訊
【圖8-4-1-2
完成的系統組態檔案,須手動新增wordpress/wp-config.php並貼上設定黨內容
【圖8-4-1-3

# ee /usr/local/www/wordpress/wp-config.php

<?php
/**
 * WordPress 基本設定檔。
 *
 * 本檔案包含以下設定選項: MySQL 設定、資料表前綴、
 * 私密金鑰、WordPress 語言設定以及 ABSPATH。如需更多資訊,請
 * 前往 {@link http://codex.wordpress.org/Editing_wp-config.php 編輯
 * wp-config.php} Codex 頁面。或者向您的空間提供商諮詢關於 MySQL 設定資訊。
 *
 * 這個檔案用於安裝程式自動生成 wp-config.php 設定檔。
 * 您不需要將它用於您的網站,可以手動複製這個檔案,
 * 並重新命名為 "wp-config.php",然後輸入相關訊息。
 *
‧略‧

【圖8-4-1-4

完成設定
【圖8-4-1-5
8-4-2首次登入
使用admin登入
【圖8-4-2-1

【圖8-4-2-2
8-4-3LDAP登入設定

由於WordPress內建,並沒有LDAP認證模組,所以需要另外下載

下載網址一:
https://wordpress.org/plugins/wpdirauth/other_notes/

下載網址二:
http://w2.testbsd.com:8080/WordPressLdap/wpdirauth.1.7.15.zip

將下載的wpdirauth.1.7.15.zip複製到本機 /tmp
搬移並解壓縮到 /usr/local/www/wordpress/wp-content/plugins/
# mv /tmp/wpdirauth.1.7.15.zip /usr/local/www/wordpress/wp-content/plugins/
# cd /usr/local/www/wordpress/wp-content/plugins/
# unzip wpdirauth.1.7.15.zip
# ls /usr/local/www/wordpress/wp-content/plugins/
akismet         hello.php       index.php       wpdirauth

再次登入網頁,點選外掛模組
【圖8-4-3-1
發現多了LDAP 認證選項,請勾選,並執行
【圖8-4-3-2
再次回到帳號管理,發現多了認證選項
【圖8-4-3-3

【圖8-4-3-4


【圖8-4-3-5


【圖8-4-3-6

8-5 LDAP用戶登入
【圖8-5-1
【圖8-5-2

【圖8-5-3

登入成功,自動帶出160601這個帳號在OpenLdap內的資訊,供使用者確認。

【圖8-5-4

如下圖,再次由admin登入,選擇[全部帳號],可以看到目前已經加入的用戶。
【圖8-5-5

8-6 參考文獻
http://wordpress.org/
https://tw.wordpress.org/
https://zh-tw.wordpress.com/create/


沒有留言:

張貼留言