在CentOS 5 VPS上配置rsync服务器

Posted by zuzhihui in Linux技术 on 2009/09/30 with No Comments

rsync是Linux下最好的同步软件,本文记录了在centos 5 VPS下配置rsync服务端的过程。

安装:
yum install -y rsync xinetd

然后rpm -ql rsync就可以看到rsync安装了哪些文件。编辑/etc/xinetd.d/rsync文件,修改disable=no,然后重启xinetd:
/etc/init.d/xinetd restart

创建文件 /etc/rsyncd.conf 内容如下:

pid file = /var/run/rsyncd.pid
port = 873
uid = root
gid = root
use chroot = yes
read only = yes
hosts allow=68.68.99.184/255.255.255.0 216.18.195.23/255.255.255.0
hosts deny=*
max connections = 5
motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[public]
path = /home/pics/www
list=yes
ignore errors
auth users = user
secrets file = /etc/rsyncd.secrets
comment = pics www

创建文件 /etc/rsyncd.motd 内容随便写即可

创建文件 /etc/rsyncd.secrets 内容是用户名和密码,比如:

user:password

然后执行如下命令:

chmod 700 /etc/rsyncd.secrets

这样就配置好了,在客户端就可以用rsync命令了,比如:

rsync rsync://user@216.18.195.23/
rsync --recursive --times --links --hard-links --delete -av rsync://user@216.18.195.23/public /home/pics/www

用美国VPS和Putty的SSH Tunnel(隧道)做安全代理

Posted by zuzhihui in Linux技术 on 2009/09/30 with 1 Comment

很多客户在美国VPS上配置VPN,然后连上美国的VPN畅游互联网。其实利用putty的ssh tunnel功能也可以实现安全的代理,原理是当用putty ssh连接到美国VPS的时候,putty可以在本地开启一个端口,本地的应用程序连接到本地的这个端口。相当于putty在本地充当了一个socks代理服务器为本地的应用程序提供socks代理。而这个socks代理通过美国VPS连接外网,socks代理和美国VPS直接的数据通信是在ssh隧道里进行的,是安全的。

配置putty的ssh隧道很简单,按照下图增加一个动态端口转发即可。另外Putty的配置不容易保存,生手要保存putty配置请参考 http://rashost.com/blog/my-putty-configure

putty ssh tunnel

上面配置完成之后,通过ssh登录到美国VPS,putty就在本地建立了一个socks代理服务器,代理地址是127.0.0.1,端口是7070。打开浏览器,设置socks代理即可无限制访问互联网了。

如果你用Firefox浏览器,推荐使用autoproxy插件,这个插件默认有ssh tunnel的socks代理配置。

使用SkyDrive做图片服务器

Posted by zuzhihui in 互联网技术 on 2009/09/28 with No Comments

SkyDrive是微软推出的免费存储服务,免费空间容量是25G,可以存放各类文件,当然也可以存放图片。

SkyDrive里面的图片支持外链,也就是说可以在网页里面引用SkyDrive的图片,比如下面的图片就是引用SkyDrive里面的:

Client Review

其链接比较长,但不影响引用:

http://qpeicw.bay.livefilestore.com/y1prlR0eJS1wVOnK2cb_6rIBzpfzW0o4LlGb1johSWV_l5p2o8KcS7I39GQ0PoIDt1R2mcl0Y6QRVSHnjBVmX80ph3InuyVqate/client-review.png

SkyDrive的地址是: http://skydrive.live.com

配置MySQL 5.0的复制(Replication)功能

Posted by zuzhihui in vps技术 on 2009/09/26 with No Comments

MySQL的Replication功能可以自动同步主MySQL服务器的更新到若干个辅MySQL服务器上,这个功能能把MySQL的数据实时分布到多台机器上,提交了MySQL的数据安全性。

配置MySQL Replication并不是个简单的工作,如果配置的不好,回导致MySQL的同步性能不好,或者不能同步,甚至导致主辅服务器的数据不一致。

下面主服务器为master,辅助服务器为slave

master的配置

第一步保证master能单机正常工作,略。

在master上创建一个MySQL用户,这个用户专门用于Replication:

grant replication slave on *.* to 'repluser'@'%' identified by 'mypassword';

编辑MySQL的配置文件,允许log-bin,并且给master分配一个ID:

[mysqld]
skip-name-resolve
server-id=10
log-bin=mysql-bin
sync_binlog=1
innodb_flush_logs_at_trx_commit=1
innodb_support_xa=1

slave的配置

配置ID等

[mysqld]
server-id=20
log_bin = mysql-bin
relay_log = mysql-relay-bin
skip_slave_start
log_slave_updates = 1
read_only
skip-name-resolve

同步数据

在master上把数据导出,并记录当前数据位置。用一个用户连接mysql并运行:

flush tables with read lock;
show master status;

然后该连接不要退出,否则read lock就失效了,记录下当前日志的文件名和位置。在另外一个窗口运行如下命令导出数据:

mysqldump -uroot -p  --all-databases |gzip -c > db.sql.gz

然后把数据文件拷贝到slave上,解压缩:

gunzip db.sql.gz

进MySQL导入:

source db.sql;

这时候slave上的数据已经同步到master的导出时刻的数据了,下面就启动自动同步的线程就可以了:

change master to master_host='1.1.1.1', master_user='repluser', aster_password='mypassword',master_log_file='mysql-bin.000006',master_log_pos=502185;
show slave status;
start slave;

show slave status;

从上面的show slave status命令的输出可以看到,IO线程和SQL线程都开始工作了。过几分钟后比较一下slave和master上的日志文件及其位置,应该就是一样的了。

注意事项

  • 应用程序不要使用数据库的root用户,一定要创建普通用户供应用程序使用,因为root用户可以在slave上进行写操作,容易导致数据不一致。

Ubuntu VPS的中文设置

Posted by zuzhihui in vps技术 on 2009/09/21 with No Comments

我们的Ubuntu VPS缺省是英文环境,如果要想在Ubuntu VPS下面能显示,输入中文,必须要做一番设置。

首先,如果用putty进行SSH登录到Ubuntu VPS上,要先保证putty支持中文,请参考:putty的常见配置

重要的还是Ubuntu VPS的中文配置:

创建文件/var/lib/locales/supported.d/zh,内容为:

zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK

运行locale-gen产生中文的locale,然后修改文件/etc/environment其中的LANG部分为:

LANG="zh_CN.UTF-8"

然后重启VPS,重启后就可以正常显示和输入中文了
 

Kloxo(原名LxAdmin)控制面板 使用指南

Posted by zuzhihui in vps技术 on 2009/09/11 with 7 Comments

Kloxo是一个优秀的Web控制面板。瑞豪开源的VPS提供了预装Kloxo的Linux系统。本文介绍Kloxo控制面板的基本使用方法。

VPS安装好之后,我们会告诉客户Kloxo的登录地址以及admin用户的密码,登录之后就可以开始配置了。

升级Kloxo到最新版本

进入Kloxo后要做的第一件事情就是升级Kloxo到最新版本,这是非常必要的,因为老版本可能有bug存在,这些bug有可能导致Kloxo被入侵,而最新版本往往修复了这些bug。

在首页中间的Administration部分,点击Update Home然后就会看到当前的Kloxo是否是最新版本,如果不是最新版本,就点击下面的Update Now按钮进行升级。

添加用户

本步骤是可选的,不是必须的。Kloxo控制面板缺省只有一个admin用户,这个用户是管理员用户,管理员用户下面可以添加很多域名。也可以创建一些普通用户,每个普通用户下面也可以绑定很多域名。

点击左侧菜单中的Clients或者首页中部的Clients,然后在新页面中点击Add Customer,然后的窗口中:

  • Client Name:用户名
  • Domain Name:这个用户的第一个域名,可以先空着不填,让用户自己登录后自己填写
  • Install Application:缺省安装的网站程序,有Wordpress, Drupal等常用的网站程序,建议不要选择,因为这里安装的都是老版本,不好
  • Password:用户的密码
  • Email Address:用户的email地址,必须填写,当用户忘记密码后可以根据Email找回
  • Send Welcome Message:这个选项要选上
  • Choose Plan:这是要开通的空间的型号,不要管,除非你是卖空间的

然后点击Add,出现新的页面,新页面里的信息不需要修改,继续点击Add即可。然后系统就会给用户的邮箱里面发生邮件,告知登录地址,用户名密码等信息。

添加域名

admin用户和普通用户都可以绑定域名,创建普通用户的时候也可以顺便绑定一个域名。

在左侧菜单中点击domains即可进入添加域名的界面,假设我们要添加的域名是 raslab.com ,那么在该界面中Domain Name部分就填写raslab.com;Document Root是域名的文件所在的目录,通常也填写为域名;其他部分不用填写,点击Add即可。

上传文件

上传文件可以通过FTP,也可以通过网页上传

在左侧菜单中点击Resources–>File Manager(admin用户需要点击domain–>File Manager),然后进入文件管理器,在文件管理器里面可以点击upload上传文件。

也可以通过FTP上传文件,一般绑定了一个域名之后会自动创建一个FTP用户,FTP用户的名字和域名是相同的,FTP密码就是当前用户的密码。当然也可以另外创建FTP用户,在左侧菜单点击Resources–>FTP Users(admin用户需要点击domain–>FTP Users)就进入管理FTP用户的界面了。

Email邮箱管理

绑定一个域名之后,以这个域名为后缀的邮箱就开通了。我们仅需要创建一个邮箱帐户就可以了。

点击左侧菜单下部的Mail Accounts进入邮箱帐户管理页面,可以在这里管理邮箱帐户。

假设域名是raslab.com,新创建的邮箱帐号是zzh,那么邮件地址就是zzh@raslab.com。邮箱用户可以通过http://webmail.raslab.com 进入Web邮箱(前提是域名的webmail记录必须指向了VPS的IP地址)。

Kloxo的中文汉化

瑞豪开源提供的Kloxo已经汉化过了,如果您的Kloxo没有汉化,可以SSH登录到VPS上,执行如下命令:

cd /usr/local/lxlabs/kloxo/httpdocs/lang/
wget dl.rashost.com/kloxo-cn.tar.gz
tar zxf kloxo-cn.tar.gz
chown -R lxlabs: cn

然后登录Kloxo,在首页点击Appearance,然后点击Language框,选择Chinese,最后点击Update按钮即可

定期删除日志脚本

在/etc/cron.daily目录下面创建文件cleankloxolog.sh,修改该文件的权限为755:

chmod 755 /etc/cron.daily/cleankloxolog.sh

这个可执行文件每天会被自动执行一次,每次执行都会删除kloxo的日志。

该文件内容如下:

#!/bin/bash
rm -rf /home/admin/__processed_stats/*
rm -rf /home/kloxo/httpd/lighttpd/*
rm -rf /var/log/kloxo/*
rm -f /home/httpd/*/stats/*

其他功能

以上简述了一下必要的功能,Kloxo还有很多其他功能,用户可以自己去探索。

Debian 5 VPS下的nginx+php+mysql的解决方案

Posted by zuzhihui in Linux技术 on 2009/09/08 with No Comments

本文介绍在Debian 5 VPS下的nginx php mysql的解决方案,本方案使用php-fpm作为fastcgi的进程管理器。

本文基于64位的Debian 5 VPS,如果是32位的Debian VPS,请在相应部分做修改。

使用php-fpm就必须重新编译php,不能使用系统自带的php。MySQL使用Debian自带的,Nginx是从Debian官方软件库中下载的最新版本。

安装Nginx

Debian 5系统自带的nginx版本比较低,现在Nginx的新稳定版本0.7.61,即将发行的Debian 6里面带的是最新版本的nginx,测试后发现这个nginx在Debian 5下可以运行。我们在 http://ftp.us.debian.org/debian/pool/main/n/nginx/ 下载了Nginx的deb包,放到了 http://dl.rashost.com/方便客户下载

安装命令:


dpkg -i nginx_0.7.61-3_amd64.deb
/etc/init.d/nginx start
mkdir -p /var/www/nginx-default
echo 'nginx ok'>/var/www/nginx-default/index.html
echo '<?phpinfo()?>' > /var/www/nginx-default/test.php

另外运行dpkg -L nginx命令可以看到nginx的文件都安装在哪些目录下面了

Debian下nginx的缺省网页目录是/var/www/nginx-default,这个目录安装的时候没有创建,我们是手工创建的。

通过浏览器访问,应该能看到nginx的缺省网页了,说明nginx正常工作了!

安装MySQL

我们使用Debian自带的MySQL,安装命令:


apt-get install mysql-server-5.0
/etc/init.d/mysql start

运行mysql -uroot -p命令,应该可以正常连接到MySQL

安装php & php-fpm

安装php所需要的库文件:


apt-get update
apt-get install libxml2 libldap-2.4-2 libmhash2 curl libpng3 libjpeg62 libsasl2-2 libmcrypt4

http://dl.rashost.com下载安装我们自己在Debian下编译的php-fpm:


cd /opt
tar zxf php-fpm-5.2.10-amd64.tar.gz
ln -s /opt/php/sbin/php-fpm /etc/init.d/php-fpm
update-rc.d -f php-fpm defaults
/etc/init.d/php-fpm start

整合

首先在/var/www/nginx-default目录下创建文件test.php,其内容很简单,只要下面一行:

<?phpinfo();?>

假设所在VPS的地址是debian5.rashost.com,这时通过浏览器访问http://debian5.rashost.com/test.php是得不到正确的显示结果的。

修改nginx的配置文件/etc/nginx/sites-enabled/default,在文件内搜索fastcgi_pass,修改该部分内容为:

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

注意,Debian下的nginx配置文件和centos下的区别比较大,Debian下把配置分割成多个文件了,推荐一个站点一个配置文件,我们修改的是/etc/nginx/sites-enabled/default。另外fastcgi_param参数后面的/var/www/nginx-default/部分,这是具体的网页目录,如果像Debian下那样写成$document_root不知道为什么就不工作了。

然后重启nginx:

/etc/init.d/nginx/restart

然后在浏览器中访问test.php页面,就应该能正确显示了,reboot VPS测试一下,各个模块应该都能自带启动。大功告成!

在Debian 5 VPS下编译php-fpm

Posted by zuzhihui in Linux技术 on 2009/09/08 with No Comments

php-fpm和spawn-fcgi一样,是一个php的fastcgi进程管理器。 spawn-fcgi是个独立的程序,而php-fpm是和php集成在一起的。一般的Linux都不带php-fpm,本文介绍在debian 5 VPS下怎样编译php-fpm。

编译环境准备

首先查看debian的apt软件库的配置,确保/etc/apt/sources.list这个文件里面至少有:

deb http://ftp.us.debian.org/debian lenny main
deb http://security.debian.org/ lenny/updates main

然后同步一下:

apt-get update

安装编译所需要的工具:

apt-get install build-essential vim

安装编译所需要的库:

apt-get install libxml2-dev libmcrypt-dev libssl-dev libldap2-dev libmhash-dev libmysqlclient15-dev libcurl4-openssl-dev libpng-dev libjpeg-dev libsasl2-dev

编译

下载php 5.2.10和相应的php-fpm补丁,然后开始编译:

tar zxf php-5.2.10.tar.gz
cd php-5.2.10
cat ../php-5.2.10-fpm-0.5.13.diff | patch -p1
./configure --prefix=/opt/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap  --without-pear --with-mysql --with-mysqli --enable-sqlite-utf8 --with-pdo-mysql --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir
make install
cp php.ini-dist /opt/php/lib/php.ini
ln -s /opt/php/sbin/php-fpm /etc/init.d/php-fpm
update-rc.d -f php-fpm defaults

编译后的php安装在/opt/php下面,php的配置文件是/opt/php/lib/php.ini

和其他Linux下不同,在Debian下这时候启动php-fpm会失败,原因是在Debian下php-fpm的配置文件中必须指定运行时的用户才行。

优化php-fpm

编辑php-fpm的配置文件/opt/php/etc/php-fpm.conf,

  • 去掉display_errors参数的注释,修改参数值为1
  • 去掉sendmail_path参数的注释
  • 去掉user,group参数的注释
  • 修改max_children参数的值为10

安装php加速器eAccelerator

tar jxf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
apt-get install -y autoconf
/opt/php/bin/phpize
./configure --enable-eaccelerator --with-php-config=/opt/php/bin/php-config
make install
mkdir /opt/php/eaccelerator_cache

然后vim /opt/php/lib/php.ini,在文件末尾加入:

[eaccelerator]
zend_extension="/opt/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/opt/php/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

然后重启php-fpm,在phpinfo()页面中应该能看到eaccelerator的信息了。

打包

我们把/opt/php目录打包为php-fpm-5.2.10-amd64.tar.gz,放到http://dl.rashost.com/下面,供客户下载使用。

Ubuntu 9.04 VPS的LNMP(linux+nginx+mysql+php)解决方案

Posted by zuzhihui in vps技术 on 2009/09/07 with No Comments

本文介绍在Ubuntu 9.04 VPS下的nginx php mysql的解决方案,本方案使用php-fpm作为fastcgi的进程管理器。

本文基于64位的Ubuntu 9.04 VPS,如果是32位的VPS,请在相应部分做修改。

使用php-fpm就必须重新编译php,不能使用系统自带的php。MySQL使用Ubuntu自带的,Nginx是从ubuntu官方下载的最新版本。

安装Nginx

ubuntu 9.04系统自带的nginx版本比较低,Nginx版本是最新稳定版本0.7.61,即将发行的ubuntu 9.10里面带的是最新版本的nginx,测试后发现这个nginx在9.04下可以运行,于是我们下载到 http://dl.rashost.com

安装命令:

dpkg -i nginx_0.7.61-1ubuntu1_amd64.deb
/etc/init.d/nginx start

mkdir -p /var/www/nginx-default
echo 'nginx ok'>/var/www/nginx-default/index.html
echo '<?phpinfo()?>' > /var/www/nginx-default/test.php

另外运行dpkg -L nginx命令可以看到nginx的文件都安装在哪些目录下面了

ubuntu下nginx的缺省网页目录是/var/www/nginx-default,这个目录安装的时候没有创建,我们是手工创建的。

通过浏览器访问,应该能看到nginx的缺省网页了,说明nginx正常工作了!

安装MySQL

我们使用ubuntu自带的MySQL,安装命令:

apt-get install mysql-server-5.0
/etc/init.d/mysql start

运行mysql -uroot -p命令,应该可以正常连接到MySQL

安装php & php-fpm

先修改/etc/apt/sources.list,把universe和multiverse加进来,修改后的文件内容是:

deb http://archive.ubuntu.com/ubuntu jaunty main universe multiverse
deb http://security.ubuntu.com/ubuntu jaunty-security main universe multiverse

然后同步软件库:

apt-get update

然后安装php所需要的库文件:

apt-get install libxml2 libldap-2.4-2 libmhash2 libmysqlclient16 curl libpng3 libjpeg62 libsasl2-2 libmcrypt4 libltdl7

http://dl.rashost.com/下载安装我们自己在ubuntu下编译的php-fpm:

cd /opt
tar zxf php-fpm-5.2.10-amd64.tar.gz
ln -s /opt/php/sbin/php-fpm /etc/init.d/php-fpm
update-rc.d -f php-fpm defaults
/etc/init.d/php-fpm start

整合

首先在/var/www/nginx-default目录下创建文件test.php,其内容很简单,只要下面一行:

<?phpinfo();?>

假设所在VPS的地址是ubuntu904.rashost.com,这时通过浏览器访问http://ubuntu904.rashost.com/test.php是得不到正确的显示结果的。

修改nginx的配置文件/etc/nginx/sites-enabled/default,在文件内搜索fastcgi_pass,修改该部分内容为:

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

注意,ubuntu下的nginx配置文件和centos下的区别比较大,ubuntu下把配置分割成多个文件了,推荐一个站点一个配置文件,我们修改的是/etc/nginx/sites-enabled/default。另外fastcgi_param参数后面的/var/www/nginx-default/部分,这是具体的网页目录,如果像centos下那样写成$document_root不知道为什么就不工作了。

然后重启nginx:

/etc/init.d/nginx/restart

然后在浏览器中访问test.php页面,就应该能正确显示了,reboot VPS测试一下,各个模块应该都能自带启动。大功告成!

在Ubuntu 9.04 VPS下编译php-fpm

Posted by zuzhihui in vps技术 on 2009/09/07 with No Comments

php-fpm和spawn-fcgi一样,是一个php的fastcgi进程管理器。spawn-fcgi是个独立的程序,而php-fpm是和php集成在一起的。一般的Linux都不带php-fpm,本文介绍在ubuntu 9.04 VPS下怎样编译php-fpm。

编译环境准备

首先查看ubuntu的apt软件库的配置,确保/etc/apt/sources.list这个文件里面至少有:

deb http://archive.ubuntu.com/ubuntu jaunty main universe multiverse
deb http://security.ubuntu.com/ubuntu jaunty-security main universe multiverse

然后同步一下:

apt-get update

安装编译工具:

apt-get install build-essential vim

安装编译所需要的库:

apt-get install libxml2-dev libmcrypt-dev libssl-dev libldap2-dev libmhash-dev libmysqlclient-dev libcurl4-openssl-dev libpng-dev libjpeg-dev libfreetype6-dev libsasl2-dev

编译

下载php 5.2.10和相应的php-fpm补丁,然后开始编译:

tar zxf php-5.2.10.tar.gz
cd php-5.2.10
cat ../php-5.2.10-fpm-0.5.13.diff | patch -p1
./configure --prefix=/opt/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap  --without-pear --with-mysql --with-mysqli --enable-sqlite-utf8 --with-pdo-mysql --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir
make
make install
cp php.ini-dist /opt/php/lib/php.ini
ln -s /opt/php/sbin/php-fpm /etc/init.d/php-fpm
update-rc.d -f php-fpm defaults
/etc/init.d/php-fpm start

编译后的php安装在/opt/php下面,php的配置文件是/opt/php/lib/php.ini

然后运行 /etc/init.d/php-fpm start 就可以启动php的fastcgi进程了,这些php fastcgi进程应该可以正常工作了。

优化php-fpm

编辑php-fpm的配置文件/opt/php/etc/php-fpm.conf,

  • 去掉display_errors参数的注释,修改参数值为1
  • 去掉sendmail_path参数的注释
  • 去掉user,group参数的注释
  • 修改max_children参数的值为10

安装php加速器eAccelerator

tar jxf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
apt-get install -y autoconf
/opt/php/bin/phpize
./configure --enable-eaccelerator --with-php-config=/opt/php/bin/php-config
make
make install
mkdir /opt/php/eaccelerator_cache

然后vim /opt/php/lib/php.ini,在文件末尾加入:

[eaccelerator]
zend_extension="/opt/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/opt/php/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

然后重启php-fpm,在phpinfo()页面中应该能看到eaccelerator的信息了。

打包

我们把/opt/php目录打包为php-fpm-5.2.10-amd64.tar.gz,放到 http://dl.rashost.com 下面,供客户下载使用。

Back to Top

2007-2017 © 北京瑞豪开源科技有限公司 京ICP备13004995号-2