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 下面,供客户下载使用。

CentOS 5 VPS的nginx+php+mysql解决方案之二

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

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

使用php-fpm就必须重新编译php,不能使用系统自带的php。我们的观点是尽量使用系统自带的,除非功能满足不了。本方案中MySQL是使用CentOS 5自带的,Nginx是我们自己编译的。

安装Nginx

centos系统不带nginx,我们用的Nginx是自己编译的,Nginx版本是最新稳定版本0.7.61,到 http://rashost.com/download 下载nginx,然后开始安装:

rpm -ivh nginx-0.7*.rpm
chkconfig --list nginx
chkconfig nginx on
/etc/init.d/nginx start
rpm -ql nginx

上面的rpm -ql nginx命令是看看nginx的文件都安装在哪些目录下面了,可以看到nginx的缺省网页目录应该是/usr/share/nginx/html/

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

安装MySQL

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

yum install -y mysql-server
chkconfig --list mysqld
chkconfig mysqld on
/etc/init.d/mysqld start

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

安装php & php-fpm

先安装php & php-fpm所依赖的一些库文件:

yum install libmhash libmcrypt libtool-ltdl libpng libjpeg curl

然后到 http://dl.rashost.com 下载我们自己编译的php-fpm并安装:

cd /opt
tar zxf php-fpm-5.2.10*.tar.gz
/opt/php/sbin/php-fpm start

然后编辑/etc/rc.local,在其中加入/opt/sbin/php-fpm start

整合

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

<?phpinfo();?>

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

修改nginx的配置文件/etc/nginx/nginx.conf,在文件内搜索fastcgi_pass,修改该部分内容为:

      location ~ \.php$ {
root           html;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
include        fastcgi_params;
}

然后重启nginx:

/etc/init.d/nginx/restart

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

在CentOS 5 VPS上编译带php-fpm功能的php

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

本文记录了在CentOS 5 VPS上编译打了php-fpm补丁的php 5.2.10的过程。

安装库文件

安装编译php需要的一些库文件

yum install libxml2-devel libmcrypt-devel openssl-devel curl-devel libjpeg-devel  libpng-devel freetype-devel openldap-devel libmhash-devel mysql-devel  libtool-ltdl-devel

如果是64位的系统,然后需要调整一下mysql的库文件,否则在64位系统下老去找32位的mysql库:
cd /usr/lib
mv mysql mysql.i386
ln -sf /usr/lib64/mysql mysql

编译php-fpm

给php打php-fpm补丁:

cd php-5.2.10
patch -p1 < ../php-5.2.10-fpm-0.5.13.diff

开始编译php,注意:如果是64位的系统,建议去掉 –with-ldap-sasl,否则有可能编译不过

./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

当编译到php-5.2.10/ext/date/lib/parse_date.c的时候,挂了,好像不往下走了,这时候ctrl-c中断编译过程,把当前正在执行的语句复制粘贴到命令行单独执行,发现还是好像死循环一样不结束,再次ctrl-c中断,删除掉这个命令中的-O2参数,继续执行,这样这个命令很快就结束了,然后继续运行:

make
make install
cp php.ini-dist /opt/php/lib/php.ini

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

优化php-fpm

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

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

安装php加速器eAccelerator

tar jxf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
yum 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目录打包放到 http://dl.rashost.com/ 下面,供客户下载使用。

最后,安装好之后,记着在/etc/rc.local文件中加入自动启动php-fpm的语句:

/opt/php/sbin/php-fpm start

spawn-fcgi从lighttpd中独立出来了

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

spawn-fcgi是一个小程序,这个程序的作用是管理fast-cgi进程,功能和php-fpm类似。

最初spawn-fcgi是lighttpd的一部分,2009年2月份,lighttpd的开发人员把spawn-fcgi单独拿出来成立了一个项目,详见 http://blog.lighttpd.net/articles/2009/02/18/prerelease-of-spawn-fcgi-1-6-0-rc1-r16 。spawn-fcgi的项目地址是 http://redmine.lighttpd.net/projects/spawn-fcgi/wiki ,目前的最新版本是1.6.2

spawn-fcgi是个新项目,很多Linux发行版都没有收录,我们瑞豪开源针对VPS常用的Linux发行版编译了spawn-fcgi,放在 供客户下载安装

http://dl.rashost.com/

CentOS 5 VPS的nginx+php+mysql解决方案之一

Posted by zuzhihui in vps技术 on 2009/09/05 with 3 Comments

在CentOS5 VPS下的nginx php mysql的解决方案有多个,本文介绍其中的解决方案之一。

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

本解决方案使用瑞豪开源自己编译的最新稳定版本的Nginxfastcgi进程管理使用spawn-fcgi,还有CentOS 5自带的5.0.45版本的MySQL和5.1.6版本的php。

优缺点

本方案的优点是使用CentOS5自带的php和mysql,扩展性好,php的各种扩展yum库里面都有,都可以直接使用;另外,由于使用系统自带的php和mysql,安全性要好一些,如果有什么漏洞都可以直接升级为centos官方的最新版本。由于使用spawn-fcgi,所以无须重新编译php。

本方案的缺点有:

  1. php和mysql都是centos自带的版本,不是最新版本,万一用到php最新版本的某些特性则就不行了。
  2. spawn-fcgi的性能不如php-fpm,如果想用php-fpm,请参考 http://rashost.com/blog/centos5-vps-nginx-solution2

安装Nginx

 http://dl.rashost.com/下载nginx-0.7.61-1.x86_64.rpm

安装命令:

rpm -ivh nginx-0.7.61-1.x86_64.rpm
chkconfig --list nginx
chkconfig nginx on
/etc/init.d/nginx start
rpm -ql nginx

上面的rpm -ql nginx命令是看看nginx的文件都安装在哪些目录下面了,可以看到nginx的缺省网页目录应该是/usr/share/nginx/html/

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

安装MySQL

yum install -y mysql-server
chkconfig --list mysqld
chkconfig mysqld on
/etc/init.d/mysqld start

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

安装PHP

yum install -y php-cgi php-mysql

安装spawn-fcgi

http://dl.rashost.com/ 下载 spawn-fcgi-1.6.2-1.32.x86_64.rpm

rpm -ivh spawn-fcgi-1.6.2-1.32.x86_64.rpm

然后在/etc/rc.local里面加入spawn-fcgi的启动命令:

spawn-fcgi -C 10 -a 127.0.0.1 -p 9000 -u nginx -d /tmp -f php-cgi

其中的-C 10参数是指启动的php fastcgi的进程数目,这个数值可以根据网站的访问量和内存大小修改。

然后先手工启动一下php:

spawn-fcgi -C 10 -a 127.0.0.1 -p 9000 -u nginx -d /tmp -f php-cgi

整合

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

<?phpinfo();?>

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

修改nginx的配置文件/etc/nginx/nginx.conf,在文件内搜索fastcgi_pass,修改该部分内容为:

      location ~ \.php$ {
root           html;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
include        fastcgi_params;
}

然后重启nginx:

/etc/init.d/nginx/restart

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

在CentOS5 VPS下编译nginx的RPM包

Posted by zuzhihui in vps技术 on 2009/09/04 with 2 Comments

Nginx是个Web服务器新秀,CentOS5官方没有Nginx的RPM包,本文记录了在64位的CentOS5 VPS下怎样编译Nginx 0.7.61版本的RPM包。

要编译RPM包,首先要有SRPM包,也就是RPM包的源代码包。可以从Nginx官网下载Nginx的源代码然后自己制作Nginx的SRPM包,这比较麻烦。本文下载了fedora 10中自带的Nginx的SRPM包,稍做修改即可。

安装SRPM包:

rpm -ivh nginx-0.7.61-1.fc10.src.rpm

上面命令把源代码安装在了/usr/src/redhat目录下,要编译RPM,需要rpmbuild命令:

yum install -y rpm-build.x86_64

然后就可以开始build了:

cd /usr/src/redhat/SPECS
rpmbuild -bb nginx.spec

build报错了,少了几个必须的库文件,我们来安装:

yum install -y pcre-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64 mod_perl-devel.x64_64

然后修改nginx.spec文件,将其中的perl-devel修改成mod_perl-devel。继续build:

rpmbuild -bb nginx.spec

大功告成!build出来的RPM包就是/usr/src/redhat/RPMS/x86_64/nginx-0.7.61-1.x86_64.rpm 。同样的方法,我们在32位的CentOS VPS下也编译了一份,然后把他们都放到http://dl.rashost.com/下供大家下载。

Back to Top

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