Debian 6+Nginx+Mysql+Php+Zend+eaccelerator网站架设
Debian 6发布了,这几天在虚拟机里装了一个服务器试了试,感觉比Ubuntu轻便,比CentOS启动快,但总有这样那样的小问题。下面把我的安装过程进行说明:
1、安装debian,选择中文,不安装任何服务;
2、安装ssh,以便在其他机器上粘贴代码:
apt-get install openssh-server
3、添加163和dotdeb源:
deb http://mirrors.163.com/debian squeeze main non-free contrib
deb http://mirrors.163.com/debian squeeze-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian-security squeeze/updates main contrib non-free
deb-src http://mirrors.163.com/debian squeeze main non-free contrib
deb-src http://mirrors.163.com/debian squeeze-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian-security squeeze/updates main contrib non-free
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | apt-key add -
更新:
apt-get update && apt-get upgrade
4、解决终端乱码:
vi /etc/default/locale
注释掉其他,添加一行:
LANG=C
5、安装网站系统:
apt-get install nginx php5-common php5-dev php5-cgi spawn-fcgi php-apc php5-mysql php5-curl php5-gd php5-idn php-pear
php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl mysql-server make
以下为可选安装项:
apt-get install php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin php5-odbc php5-ladp
6、启动php5-fpm时出现错误:
Starting php5-fpm PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/fpm/conf.d/ming.ini on line 1 in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - idn_to_ascii in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - idn_to_utf8 in Unknown on line 0
PHP Warning: idn: Unable to register functions, unable to load in Unknown on line 0
Segmentation fault
failed
解决办法:
一是
vi /etc/php5/fpm/conf.d/ming.ini
将#改为;即可。
二是
vi /etc/php5/fpm/conf.d/idn.ini
想不到其他办法,注释掉语句,网上也找不到相关资料。
7、安装eaccelerator和zendguardloader
sudo mkdir /usr/zend
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
wget http://phpcj.googlecode.com/files/ZendGuardLoader.so
sudo mv ZendGuardLoader.so /usr/zend/ZendGuardLoader.so
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar xvjf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
cp control.php /var/www/control.php //复制控制程序到网站目录,通过http://网站名/control.php访问,默认帐号为
admin,密码为eAccelertor,可编辑此文件修改。
phpize
sudo ./configure --enable-eaccelerator=shared
sudo make
sudo make install
sudo vi /etc/php5/fpm/php.ini
在配置文件最后加上:
代码:
zend_extension=/usr/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_extension="/usr/lib/php5/20090626+lfs/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path="/var/www/control.php"