日期:2014-05-16  浏览次数:20968 次

VPS(ubuntu server 10.04)上安装Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator,安装wordpress

1.安装 rz/sz和SSH:

sudo apt-get install lrzsz
sudo apt-get install openssh-server

?
2.lucid(10.04)的源添加如下:

sudo vi /etc/apt/sources.list

?

deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main

?


最后一行为nginx的ppa源,需要添加key,在终端运行:

sudo apt-key adv --keyserver keyserver.Ubuntu.com --recv-keys C300EE8C

?


更新

sudo apt-get update

?
3.安装网站系统

sudo apt-get install nginx php5-common php5-dev php5-cgi php5-fpm 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

?


上面为必选安装,以下php组件为可选安装,一般网站程序可能用不着:

sudo apt-get install php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin php5-odbc php5-ladp

?


4.修改nginx配置

sudo vi /etc/nginx/sites-enabled/default

?

把其中的:

root   /usr/share/nginx/www;
index  index.html index.htm;

?

改为:

root   /usr/share/nginx/www;
index  index.php index.html index.htm;

?

其中的:

#location ~ \.php$ {
#   fastcgi_pass 127.0.0.1:9000;
#   fastcgi_index index.php;
#   include fastcgi_params;
#}

?

改为:

location ~ \.php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/www$fastcgi_script_name;
        include  fastcgi_params;
}

?


更改网站目录权属:

sudo chown -R yourusername /usr/share/nginx/www/

?


5.安装ZendGuardLoader及eaccelerator:

修改php版本号,以避免因为从源安装版本号不一致,导致eaccelerator启动报错:

sudo vi /usr/include/php5/main/php_version.h

?

#define PHP_VERSION “5.3.2-1ubuntu4.7″

?
修改为

#define PHP_VERSION “5.3.2-1ubuntu4.7ppa5~lucid1″

?

sudo mkdir /usr/zend
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
cd /tmp
wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
sudo mv ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/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 /usr/share/nginx/www/control.php //复制控制程序到网站目录,通过http://网站名/control.php访问,默认帐号为admin,密码为eAccelertor,可编辑此文件修改。
phpize 
sudo ./configure --enable-eaccelerator=shared
sudo make 
sudo make