DDR爱好者之家 Design By 杰米

环境
系统:FreeBSD7.0
软件:mysql-5.0.51a,nginx-0.6.30,lighttpd-1.4.19,php-5.2.6
所有软件都安装到/usr/local/vhost,如果需要请自行修改
一、下载源代码

cd /usr/ports/databases/mysql50-server/

make fetch

cd /usr/ports/www/nginx-devel/
make fetch

cd /usr/ports/lang/php5
make fetch

cd /usr/ports/www/lighttpd
make fetch

二、编译安装
MySQL

cd /usr/ports/distfiles/

tar -jxf mysql-5.0.51a.tar.gz 
cd mysql-5.0.51a
 ./configure --prefix=/usr/local/vhost/mysql --with-charset=utf8 --with-extra-charsets=all --with-big-tables --with-pthread
make &&make install

Nginx

cd /usr/ports/devel/pcre

make install clean

cd /usr/ports/distfiles/
tar -jxf nginx-0.6.30.tar.gz 
cd nginx-0.6.30
./configure --prefix=/usr/local/vhost/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module
make &&make install

Lighttpd
(安装lighttpd是为了得到启动fastcgi进程)

cd /usr/ports/distfiles/

tar -jxf lighttpd-1.4.19.tar.bz2 
cd lighttpd-1.4.19
./configure --prefix=/usr/local/vhost/lighttpd

Php

cd /usr/ports/textproc/libxml2

make install clean

cd /usr/ports/ftp/curl
make install clean

cd /usr/ports/graphics/jpeg
make install clean

cd /usr/ports/graphics/png
make install clean

cd /usr/ports/devel/gettext
make install clean

cd /usr/ports/distfiles/
tar -jxf php-5.2.6.tar.bz2 
cd php-5.2.6
./configure --prefix=/usr/local/vhost/php --with-mysql=/usr/local/vhost/mysql -enable-fastcgi --enable-sockets --enable-ftp --enable-zip --enable-mbstring --enable-mbregex --enable-calendar --with-curl=/usr/local/clude --with-curlwrappers --disable-debug --enable-inline-optimization --with-zlib --with-gd --with-kerberos --with-gettext --enable-force-cgi-redirect --with-jpeg-dir=/usr/inlocal/clude --with-png-dir=/usr/local/include --with-bz2 --enable-pcntl --with-iconv 
make && make install
cp php.ini-dist /usr/local/vhost/php/lib/php.ini

三、配置

MySQL

cd /usr/local/vhost/mysql

pw adduser mysql -d /dev/null -s /sbin/nologin
bin/mysql_install_db
cp share/mysql/mysql.server ./
chmod +x mysql.server
chown -R mysql ./

启动
引用:/usr/local/vhost/mysql/mysql.server start


 配置nginx

cd /usr/local/vhost/nginx/

pw adduser webuser -d /dev/null -s /sbin/nologin
cp /usr/local/vhost/lighttpd/bin/spawn-fcgi ./sbin/
rm -rf /usr/local/vhost/lighttpd

vi sbin/php.sh

#!/bin/sh

/usr/local/vhost/nginx/sbin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 8 -u webuser -f /usr/local/vhost/php/bin/php-cgi