一、安装配置Mysql
#cd /usr/ports/databases/mysql51-server
# make with-debug=no with-unix-socket-path=/tmp/mysql.sock with-client-ldflags=-all-static with-mysqld-ldflags=-all-static witch-assembler=yes with-extra-charsets=gbk,gb2312,utf8 with-pthread=yes enable-thread-safe-client=yes install clean
#cp /usr/local/share/mysql/my-large.cnf /usr/local/etc/my.cnf
#rehash
# mysql_install_db –user=mysql
#/usr/local/bin/mysqld_safe &
#/usr/local/bin/mysqladmin -u root password ‘mypassword’
二、安装 php
#cd /usr/ports/lang/php5
#make config #(还是Freebsd爽吧,哈哈)
图1
#make install clean
# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
#安装 php扩展
# cd /usr/ports/lang/php5-extensions/
#make config
#安装常用的库呗,什么GD、FTP、CURL GETTEXT MBSTRING MYSQL MCRYPT PCRE ZIP ZLIB能装的都给他装上。。。
#我们的口号是只求需要不求全部^_^
make install clean
三、安装nginx
#cd /usr/ports/www/nginx
#make install
四、安装lightTPD
# cd /usr/ports/www/lighttpd/
#make install
五、配置nginx
ee /usr/local/etc/nginx.conf
【去掉下列的#】
#user nobody
#log_format main ‘$remote_addr – $remote_user [$time_local] ‘
# ‘”$request” $status $body_bytes_sent ‘
# ‘”$http_referer” “$http_user_agent”‘;
location / {
root /usr/local/www/nginx; #(这个好理解,根目录呗,哈哈)
index index.php index.html index.htm;
}
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script.name;
# include fastcgi_params;
#}
六、启动spawn-fcgi
#/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -C 64 -f /usr/local/bin/php-cgi
七、测试
#cd /usr/local/www/nginx
#vim info.php
<?php
phpinfo();
?>
八、bench一下:
/usr/local/bin/webbench -c 1000 -t 10 http://localhost/info.php
补充:
装完发现zf运行不了,发现没装pdo_mysql,哈哈。
#cd /usr/ports/databases/php5-pdo_mysql
#make install clean