• 公告栏使用li标签,同时你可以使用FontAwesome以及其他HTML语法
  • FontAwesome示例
  • 如果人民不欢迎我们, 我们就该下台了!@胡耀邦

Freebsd8.2 32位ports安装php5.2+fpm+mysql5.1+nginx+Zend

*BSD shaobo 47次浏览 3347字 0个评论

一、安装软件前的准备:

系统的安装:让机房最小化安装32位freebsd8.2系统。

ports的安装:机房装好系统后,远程登录,自己在线安装ports

命令:

sysinstall->Configure->Distributions->ports->FTP->China->OK

修改系统密码:passwd回车

二、手动安装nginx+php

(1) 进入系统后,准备cvs更新:

1. cd /usr/ports/net/cvsup-without-gui

# make install clean

2. cp /usr/share/examples/cvsup/ports-supfile /etc/ports-supfile

3. # ee /etc/ports-supfile

将其中的#*default host=CHANGE_THIS.FreeBSD.org一行改为:

*default host=cvsup4.FreeBSDchina.org

{也可以指定更新版本日期,例如加上:*default date=2009.10.05.00.00.00

(这个可以省略)

}

4. 更新ports

/usr/local/bin/cvsup -g -L 2 /etc/ports-supfile

2) 安装mysql

#cd /usr/ports/databases/mysql51-server

#make WITH_CHARSET=gbk WITH_XCHARSET=all WITH_PROC_SCOPE_PTH=yes BUILD_OPTIMIZED=yes BUILD_STATIC=yes SKIP_DNS_CHECK=yes WITHOUT_INNODB=yes install clean

#cp /usr/local/share/mysql/my-large.cnf /usr/local/etc/my.cnf ##mysql的优化参数,也可以手动修改

#rehash

# mysql_install_db --user=mysql ##初始化mysql

#/usr/local/bin/mysqld_safe & ##启动mysql

#/usr/local/bin/mysqladmin -u root password 'newpass'

##设置root密码,newpass是你需要设置的密码

关闭mysql可以使用mysqladmin -uroot -p shutdown

mysqladmin -uroot -p password '新密码' 回车后输入旧密码

mysql -uroot -p #登陆mysql monitor.

3) 安装php

# cd /usr/ports/lang/php52装的是5.2版本,后装php5-extensions的时候对应的要cd /usr/ports/lang/php52-extensions

#make config ##配置编译参数

[X] CLI Build CLI version

[X] CGI Build CGI version

[ ] APACHE Build Apache module

[ ] DEBUG Enable debug

[X] SUHOSIN Enable Suhosin protection system

[X] MULTIBYTE Enable zend multibyte support

[ ] IPV6 Enable ipv6 support

[ ] REDIRECT Enable force-cgi-redirect support (CGI only)

[ ] DISCARD Enable discard-path support (CGI only)

[X] FASTCGI Enable fastcgi support (CGI only)

[X] FPM Build FPM version //php5.2 FPM依赖FASTCGI

[X] PATHINFO Enable path-info-check support (CGI only)

#make install clean

# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

4)升级libtool

#cd /usr/ports/devel/libtool/ && make reinstall clean

 

5) 安装php52-extensions

#cd /usr/ports/lang/php52-extensions //5.2版本的php必须对应装5.2版本的扩展

#make config

Options for php5-extensions 1.1

-------------------------------------------------

[X] CURL CURL support

[ ] FTP FTP support//咱们不要

[X] GD e in

[X] GETTEXT

[X] MBSTRING multibyte string support

[X] MCRYPT Encryption support

[X] MYSQL

[X] MYSQLi

[ ] PCRE Perl Compatible Regular Expression support

[ ] POSIX //去掉.

[ ] SQLITE //去掉.

[X] ZIP ZIP support

[X] ZLIB

# make install clean

不同以前版本,安装完php52-extensions发现很多扩展并没有安装,手动挨个去安装吧,包括:mysql、mysqli、gd、mbsting、curl,其中,安装gd扩展耗时较长,下载依赖类库较多,多次弹出选择框。

# cd /usr/ports/databases/php52-mysql

# make install clean

# cd /usr/ports/databases/php52-mysqli

# make install clean

# cd /usr/ports/graphics/php52-gd

# make install clean

# cd /usr/ports/converters/php52-mbstring

# make install clean

# cd /usr/ports/ftp/php52-curl

# make install clean

 

6) 安装Zend Optimizer

 

#cd /usr/ports/devel/ZendOptimizer/

 

#make #不要安装,只需要下载解包

 

#cd /usr/ports/devel/ZendOptimizer/work/ZendOptimizer-*

 

#./install-tty ##会出现一个文字的安装界面,只是最后一步,不要选择apache就可以了

6)        安装nginx

#cd /usr/ports/www/nginx/

#make install

 

配置nginx

在index.html前面添加一个index.php

 

location / {

root   /usr/local/www/nginx; #虚拟目录名

index   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;

#}

将前面的#去掉,修改为

location ~ \.php$ {

fastcgi_pass    127.0.0.1:9000;

fastcgi_index   index.php;

fastcgi_param CRIPT_FILENAME     /usr/local/www/nginx$fastcgi_script_name;

include     fastcgi_params;

}

/usr/local/sbin/php-fpm  //手动启动php-fpm

/usr/local/sbin/nginx  // 手动启动nginx

7)添加开机自启动:

在/etc/rc.conf中加入下面三行内容:

mysql_enable="YES"

nginx_enable="YES"

php_fpm_enable="YES"


喜欢 (0)

您必须 登录 才能发表评论!