星期五, 十月 12, 2007

Install Muti User WordPress

Install Muti User WordPress


see http://mu.wordpress.org/
這個網站就是專門發展多人用的 WordPress 版本。

http://trac.mu.wordpress.org/browser/trunk/README.txt
這一個 readme 要先看完才知道要怎麼安裝成多人版。
底下我也附了一份說明!
說明中提到了要有一些必備的環境,簡單說明一下:
一、about apache web server
1. apache webserver 需支援到 mod_rewrite, 不管你是 compile 到 httpd or 用 LoadModule 的方式。
2. 需將 AllowOverride None 改成 AllowOverride FileInfo Options。
3. 中,需加入 ServerAlias *.yourblog.domain,因為我是想裝成 aaaa.
yourblog.domain, bbbb.yourblog.domain 等 sub domain 型式,而不是 sub directory 型式。

二、about DNS
1. 既然是要裝成 sub domain,那你的 DNS 當然要設定成 wildcard record。
$ORIGIN
yourblog.domain.
blog A 1.2.3.4
$ORIGIN
yourblog.domain.
* CNAME blog.
yourblog.domain.

三、about PHP.ini
1. 修改 php.ini 的幾個值
register_globals = off ; 不使用 GLOBAL variables
display_errors = off ; 不顯示 php 的錯誤在網頁上

memory_limit = 64M ; 預設的太小, MU WordPress 建議改大一點

四、create database for MU WordPress

1. 這一個 MU 的做法是在一個 DB 裡頭為每一個 BLOG 建立不同名稱的 TABLE,用 ID 漸增。所以要先建一個 database 和開一個 account,這一個 account 是對這一個 DB 有完整的 privileges。

2. 用 root 登入之後,下SQL語法建立 DB。

create database wp_dbname defalut charset utf8;

這裡會先指定成 utf8 是因為我在第一次安裝時 MU 時,結果雖然在 wp-config.php 有明確設定 DB_CHARSET 為 utf8,但是 MU 所建立的 table 卻都還是 latin1。這樣會造成無法正常輸入 big5。找不到原因,所以我干脆在建 DB 時就給它預設值,這樣所建立的 TABLE 就都是 utf8 了。

建立 USER 跟給 privileges,

GRANT ALL PRIVILEGES ON wp_dbname.* TO 'wp_username'@'localhost' IDENTIFIED BY 'pwd_connect_db' WITH GRANT OPTION;
立即生效 privileges,
FLUSH PRIVILEGES;

五、install MU WordPress
1. 把 download 到的 sources 解開來,將所有檔案複製到 blog.
yourblog.domain 的 DocumentRoot( 設定在 /wordpress/blog )。
2.
目錄都是的 owner,group 都是 root 沒關係。只要在安裝前先改兩個權限就好。
chmod 777 /wordpress/blog /wordpress/blog/wp-content
記得安裝完要改回成 755
3. 完成已上動作之後,從 browser 執行安裝。 http://blog.yourblog.domain/index.php 然後照著上面的步驟填入相關資訊即可完成安裝。
4. 裝完之後,目錄權限改回。
chmod 755
/wordpress/blog /wordpress/blog/wp-content
要這樣改來改去是因為,網頁的安裝會產生兩個檔案和一個目錄
wp-config.php, .htaccess , wp-contnet/blogs.dir

wp-config.php
如果安裝個人版 wordpress,wp-config.php 是解開SOURCES 就會有的檔案,但是多人版是沒有的,上述的 DB_CHARSET 在個人版也是沒有的問題,但是 MU 就會有。我在猜可能跟這一個 wp-config.php 有關。

.htaccess
這一個檔案在做 sub domain 網址的 mod_rewrite。所以它是不會去動到 apache 的 httpd.conf

blogs.dir
則是要放其它 blog 的個人檔案用的。如圖片等。

以上,這樣就裝完基本的 MU WordPress 了。




---------------------------------- 官網的說明文件 -----------------------------------------------------
WordPress Multi User
--------------------

WordPress MU is a multi user version of WordPress.

If you're not comfortable editing PHP code, taking care of a complex
webserver and database system and being pro-active about following
developments of this project then run, don't walk, to
http://wordpress.com/ and sign yourself and your friends up to free blogs.
It's easier in the long run and you'll save yourself a lot of pain
and angst.

Apache
======
Apache must be configured so that mod_rewrite works. Here are
instructions for Apache 2. Apache 1.3 is very similar.

1. Make sure a line like the following appears in your httpd.conf
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

2. In the directive of your virtual host, look for this
line
"AllowOverride None"
and change it to
"AllowOverride FileInfo Options"

3. In the section of the config file for your host there
will be a line defining the hostname. You need to add the following
if you want virtual hosts to work properly:
"ServerAlias *.domain.tld"
Replace domain.tld with whatever your one is, and remove the quotes.


DNS
===
If you want to host blogs of the form http://blog.domain.tld/ where
domain.tld is the domain name of your machine then you must add a
wildcard record to your DNS records.
This usually means adding a "*" hostname record pointing at your
webserver in your DNS configuration tool.
Matt has a more detailed explanation:
http://photomatt.net/2003/10/10/wildcard-dns-and-sub-domains/


PHP
===
1. Don't display error messages to the browser. This is almost always
turned off but sometimes when you're testing you turn this on and forget
to reset it.

2. If your PHP is compiled with memory limit checks, the default is 8MB
which is much too small. You should increase this to at least 32MB or 64MB
to avoid PHP out of memory errors. Look for "memory_limit" in your php.ini
file.

3. GLOBAL variables must be turned off. This is one of the first things
any security aware admin will do. These days the default is for it to
be off!

The easiest way of configuring it is via the .htaccess file that is
created during the install. If you haven't installed WPMU yet then edit
the file htaccess.dist in this directory and add these two lines at the
top:

php_flag register_globals 0
php_flag display_errors 0

This is NOT included in that file by default because it doesn't work on
all machines. If it doesn't work on your machine, you'll get a cryptic
"500 internal error" after you install WPMU. To remove the offending lines
just edit the file ".htaccess" in your install directory and you'll see
them at the top. Delete and save the file again.
Read here for how to enable this: http://ie.php.net/configuration.changes

If you don't want to edit your .htaccess file then you need to change your
php.ini. It's beyond the scope of this README to know exactly where it is
on your machine, but if you're on a shared hosted server you probably
don't have access to it as it requires root or administrator privileges
to change.

If you do have root access, try "locate php.ini" or check in:

/etc/php4/apache2/php.ini
/usr/local/lib/php.ini

Once you have opened your php.ini, look for the sections related to
register_globals and display_errors. Make sure both are Off like so:

display_errors = Off
register_globals = Off

You'll have to restart Apache after you modify your php.ini for the
settings to be updated.

4. If you want to restrict blog signups, set the restrict domain email
setting in the admin.


Install
=======
1. Download and unzip the WordPress MU package, if you haven't already.
The unzipped files will be created in a directory named "wordpressmu"
followed by a version number.
2. Create a database for WordPress MU on your web server, as well as a
MySQL user who has all privileges for accessing and modifying it.
3. Place the WordPress MU files in the desired location on your web server:
* If you want to integrate WordPress MU into the root of your
domain (e.g. http://example.com/), move or upload all the files and
directories of the unzipped WordPress MU directory into the root
directory of your web server.
* If you want to have your WordPress MU installation in its own
subdirectory on your web site (e.g. http://example.com/blogs/),
rename the directory wordpressmu to the name you'd like the
subdirectory to have and move or upload it to your web server.
For example if you want the WordPress MU installation in a
subdirectory called "blog", you should rename the directory called
"wordpressmu" to "blogs" and upload it to the root directory of your
web server.
4. Make sure your install directory and the wp-contents directory are
writeable by the webserver.
5. Run the WordPress MU installation script by accessing index.php
in your favorite web browser.
* If you installed WordPress MU in the root directory, you should
visit: http://example.com/index.php
* If you installed WordPress MU in its own subdirectory called
blogs, for example, you should visit: http://example.com/blogs/index.php
(Adapted from http://codex.wordpress.org/Installing_WordPress)

If you're upgrading, skip to the end of this document.

ERROR LOGGING
=============
If you are developing a site based on WPMU it is recommended that you
turn on PHP error logging. Look in your php.ini for the section marked
"Error handling and logging" where you can configure it.

Mysql database errors are logged to the PHP error log if enabled or it
can also send error reports to a file of your choice. After installing,
edit wp-config.php and define a constant, "ERRORLOGFILE", pointing at
your MySQL error log. This file must be writeable by your webserver.
Please don't log to a file visible by your webserver or people may
figure out they can download it.
Example definition:
define( "ERRORLOGFILE", "/tmp/mysql.log" );


UPGRADING
=========
Please see this page for instructions on upgrading your install:
http://trac.mu.wordpress.org/wiki/UpgradingWpmu


Support Forum and Bug Reports
=============================
Please read http://trac.mu.wordpress.org/wiki/DebuggingWpmu before
asking any questions. Without all the information required there
we'll just ask for it anyway or worse, your request will be ignored.

http://mu.wordpress.org/forums/

Trac is our bug tracking system. Again, please read the above link
before submitting a bug report.
http://trac.mu.wordpress.org/report/1

You can login to both sites using your wordpress.org username and
password.

http://mu.wordpress.org/