作者:freemongolia 来源: http://bbs.chinaunix.net <script language="javascript" src="/plus/ad_js.php?aid=28" type="text/javascript"></script>
FreeBSD6.2架设Discuz!6.0 BBS服务器指南
Discuz!6.0 BBS Server>Mongolia
Index:
简介
- Step 1 installation Apache22.
- Step 2 installation MySQL Server.
- Step 3 installation PHP.
- Step 4 ZendOptimizer.
- Step 5 Discuz!6.0.
- F.A.Q.
- Links to other sources
简介
学习FreeBSD很久了,一直是菜鸟水平。现在记录下我的BBS>安装历程,发表到CU论坛,请各位达人批评指正。
本文目标:
使用Very Very Good的FreeBSD6.2作为系统,原因是高人们说这个小恶魔很稳定、很快速。而且有独特的FreeBSD最引以为傲的Ports,所以系统使用FreeBSD6.2。Ports的好处是,安装程序方便(只需找到程序目录,然后执行make install clean),升级维护程序方便,卸载方便。本文的应用程序均使用Ports方式安装。FreeBSD6.2+Apache22+PHP5+php5-extensions+ZendOptimizer+ Discuz!6.0
软件版本信息:
FreeBSD 6.2-RELEASE
Apache-2.2.3
- Mysql-server-5.0.27
- Php5-5.1.6_3
- Php5-extensions-1.0
- ZendOptimizer-3.0.1_1
- Perl-5.8.8
-
Discuz!_6.0.0_SC_UTF8.zip
- Step 1 安装 Apache22.
Installation of the Apache server:
跟随下面步骤安装 Apache2.
Shell:
cd /usr/ports/www/apache22
make install clean
安装完成后,需要编辑/etc/rc.conf文件,添加下面内容到/etc/rc.conf(要添加的内容,可以cat /usr/local/etc/rc.d/apache22查看到具体说明)
Editor:
# Apache 22
apache2_enable="YES"
index.JPG (103.09 KB) 2007-10-1 14:15
Step 2 安装 MySQL.
Installation of the MySQL server:
安装MySQL server5.0
Shell:
cd /usr/ports/databases/mysql50-server
make install clean
安装完成后,需要编辑/etc/rc.conf文件,添加下面内容到/etc/rc.conf
Editor:
# MySQL Server 5.0
mysql_enable="YES"
mysqllimits_enable="NO"
启动MySQL服务
Shell:
/usr/local/etc/rc.d/mysql-server start
使用mysqladmin命令更改MySQL密码
Shell:
mysqladmin -uroot password 'passwd' (passwd是你要设置的密码)
Step 3 安装 PHP.
Installation of the PHP:
安装PHP5
Shell:
cd /usr/ports/lang/php5
make install clean
选择如下安装选项
Options for php5 5.1.6_3
[X]
CLI
Build CLI version
[X]
CGI
Build CGI version
[X]
APACHE
Build Apache module
[X]
SUHOSION
Enable Suhosin protection system
[X]
FASTCGI
Enable fastcgi support (CGI>[X]
PATHINFO
Enable path-info-check support (CGI>
安装完成后,备份/usr/local/etc/apache22/httpd.conf文件
Shell:
cp /usr/local/etc/apache22/httpd.conf /usr/local/etc/apache22/httpd.conf.bak
编辑/usr/local/etc/apache22/httpd.conf文件,以使Apache22 Server支持php
编辑/usr/local/etc/apache22/httpd.conf,在AddType application/x-gzip .gz .tgz(大约354行)下面添加以下内容
Editor:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
修改前:
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
修改后:
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
先不要退出,添加'index.php' 到'DirectoryIndex' 主目录索引(大约212行)
Editor:
DirectoryIndex index.php index.html index.html.var
修改前:
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
修改后:
#
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm index.html.var
</IfModule>
#
Installation of the PHP Extensions:
安装php5-extensions扩展.
Shell:
cd /usr/ports/lang/php5-extensions
make config
make install clean
安装选项如下:
详细安装选项
Options for php5-extensions 1.0
[X]
BZ2
bzip2 library support
[X]
CALENDAR
calendar conversion support
[X]
CTYPE
ctype functions
[X]
GD
GD library support
[X]
ICONV
iconv support
[X]
MBSTRING
multibyte string support
[X]
MYSQL
MySQL database support
[X]
PCRE
Perl Compatible Regular Expression support
[X]
POSIX
POSIX-like functions
[X]
SESSION
session support
[X]
SOCKETS
sockets support
[X]
TOKENIZER
tokenizer support
[X]
ZIP
ZIP support
[X]
ZLIB
ZLIB support
复制/usr/local/etc/php.ini-dist为/usr/local/etc/php.ini
Shell:
cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
安装完成后,重新启动你的 web server.
Execute the following command to start / restart the Apache webserver.
Shell:
apachectl restart
提示:
如果出现这样的错误
root@WOW[/root]#apachectl restart
httpd not running, trying to start
[Sat Sep 29 16:05:07 2007] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
解决办法:
在/boot/loader.conf添加accf_http_load=”yes”
root@WOW[/root]#echo accf_http_load="YES" >> /boot/loader.conf
然后reboot一下就可以解决了
这是因为Apache无法开启FreeBSD下accept filter 的机制,
FreeBSD 系统还提供了http filter,会自动过滤掉不完整的HTTP请求。
解决方法:
root@WOW[/root]#kldload accf_http
并修改/boot/defaults/loader.conf,以便下次启动自动装载模块(大约364行)
修改前:
accf_data_load="NO"
accf_http_load="NO"
修改后:
accf_data_load="YES"
accf_http_load="YES"
测试Apache Server
浏览器打开http://youipaddress
显示:
It works!
OK,现在Aapche Server工作正常。什么?为什么只有一行It works!?因为FreeBSD开发的达人们只追求速度、简单,呵呵。
Step 4 安装 ZendOptimizer.
Installation of the ZendOptimizer:
安装ZendOptimizer.
Shell:
root@ohaha[/root]#cd /usr/ports/devel/ZendOptimizer/
root@ohaha[/usr/ports/devel/ZendOptimizer/]#make install clean
安装完成提示如下
********************************************************************************
You have installed the ZendOptimizer package.
Edit /usr/local/etc/php.ini and add:
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer="/usr/local/lib/php/20060613/Optimizer"
zend_extension_manager.optimizer_ts="/usr/local/lib/php/20060613/Optimizer_TS"
zend_extension="/usr/local/lib/php/20060613/ZendExtensionManager.so"
zend_extension_ts="/usr/local/lib/php/20060613/ZendExtensionManager_TS.so"
********************************************************************************
编辑/usr/local/etc/php.ini
增加内容如下
Editor:
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer="/usr/local/lib/php/20060613/Optimizer"
zend_extension_manager.optimizer_ts="/usr/local/lib/php/20060613/Optimizer_TS"
zend_extension="/usr/local/lib/php/20060613/ZendExtensionManager.so"
zend_extension_ts="/usr/local/lib/php/20060613/ZendExtensionManager_TS.so"
重新启动你的 web server.
Execute the following command to start / restart the Apache webserver.
Shell:
apachectl restart
测试Aapche Server 对PHP和ZendOptimizer支持
浏览器打开http://youipaddress
显示:
PHP Version 5.1.6
System
FreeBSD ohaha.3322.org 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
Build Date
Oct 1 2007 08:43:04
Configure Command
'./configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection' '--enable-spl' '--program-prefix=' '--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs' '--with-regex=php' '--with-zend-vm=CALL' '--disable-ipv6' '--prefix=/usr/local' 'i386-portbld-freebsd6.2'
OK,现在Aapche Server支持PHP工作正常。
Step 5 安装 Discuz!6.0.
[/url]
Installation of the PHP Extensions:
安装Discuz!6.0论坛BBS程序
登陆[url=http://www.discuz.com/download/]http://www.discuz.com/download/官方网站下载简体 UTF-8版本Discuz!6.0
Shell:
cd /tmp
fetch " http://download.discuz.net/6.0.0/Discuz!_6.0.0_SC_UTF8.zip"
tar zxvf Discuz/!_6.0.0_SC_UTF8.zip
cd ftp
chown www config.php