运行于Unix下非常优秀的Web服务器 Zeus

来源:岁月联盟 编辑:zhuzhu 时间:2007-08-23
运行于Unix下非常优秀的Web服务器 Zeus内容简介:Zeus是一个运行于Unix下的非常优秀的Web Server,据说性能超过Apache,是最强的Web Server之一 由于Zeus的中文介绍非常少,很多管理员不知道这个超级Web Server,有些知道的苦于中文安装说明很少, 下面的安装

Zeus是一个运行于Unix下的非常优秀的Web Server,据说性能超过Apache,是最强的Web Server之一

 

由于Zeus的中文介绍非常少,很多管理员不知道这个超级Web Server,有些知道的苦于中文安装说明很少,

下面的安装环境 FreeBSD4.9,更新了源代码树,重新编译了内核和系统,ports最新!进入系统su变成root

 

1、安装MySQL

 

cd /usr/ports/databases/mysql323-server

make install

make clean

/usr/local/bin/safe_mysqld & 启动mysql

/usr/local/bin/mysqladmin -uroot password 密码 修改mysql root口令,

默认为空

/usr/local/bin/mysql -uroot -p密码

如果出现 mysql> 恭喜你安装成功了

 

2、安装fastcgi

 

cd /usr/ports/www/fcgi/

make install

make clean

完成后在/usr/local/lib目录中看到有libfcgi.a文件,

在/usr/local/include目录中会有fastcgi的所有头文件

 

3、安装php

 

cd /usr/ports/www/php4-cgi

make WITH_FASTCGI=yes install

当中会就叫你选择你需要的php模块,选择你需要的php模块把

make clean

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

测试

/usr/local/bin/php

输入

 

按ctrl-d运行后会见到php返回的信息说明安装成功

 

4、安装 zeus

 

下载地址 http://www.axin.net/Zeus_42r4_FreeBSD4.tar他的注册文件

 

 

 

http://www.axin.net/license.keycd /home/axinmkdir servercd serverfetch http://www.axin.net/Zeus_42r4_FreeBSD4.tar下载zeusfetch http://www.axin.net/license.key下载licenstar vxf Zeus_42r4_FreeBSD4.tar解开cd Zeus_42r4_FreeBSD4./zinstall按CTRL+C打入acceptWhere should the product be installed?[/usr/local/zeus]: 问你要安装到哪里默认usr/local/zeusInstallation options:1. Full install of both admin server& web server2. Stand-alone install of admin server3. Clustered install of web serverH. HelpChoose installation option [1]: 选择安装模式 1吧 全部安装Enter the key filename, or leave blank for unlicensed mode: /home/axin/server/license.key (输入密匙位置)Please choose a password for the admin server: ****** (输入管理员密码)Re-enter: ****** (重新输入密码)Would you like Zeus to start at boot time? Y/N [Y]: (回车)

 

安装很简单

 

测试一下 http://ip:9090 安装成功的话就会跳出一个认证窗口,输入 admin 密码 就可以看到zeus的后台了。爽吧,别激动,先把其他的弄好

 

5、安装 zend

 

 

cd /home/axin/server下载zendtarzvxf ZendOptimizer-2[1].5.1-FreeBSD4.0-i386.tar.gzcd ZendOptimizer-2.5.1-FreeBSD4.0-i386./install.sh问Are you using Apache web server?的时候选No

 

6、安装

 

 

mmcachecd /usr/ports/www/truck-mmachemake installmake cleanvi /usr/local/etc/php.ini加上[mmcache]zend_extension="/usr/local/lib/php/20020429/mmcache.so"mmcache.shm_size="16"mmcache.cache_dir="/var/tmp/mmcache"mmcache.enable="1"mmcache.optimizer="1"mmcache.check_mtime="1"mmcache.debug="0"mmcache.filter=""mmcache.shm_max="0"mmcache.shm_ttl="0"mmcache.shm_prune_period="0"mmcache.shm_only="0"mmcache.compress="1"mmcache.keys="shm_and_disk"mmcache.sessions="shm_and_disk"mmcache.content="shm_and_disk"

 

7、Zeus 简单使用

 

浏览器输入:http://ip:9090 输入admin 安装时设置的密码进入Zeus得后台,功能之强大,让我想一起一个资深开源玩家说的,Zeus是众神之首,

 

这里简单教大家开设虚拟主机

 

Create Virtual Server

Virtual Server Name 虚拟主机名Host Name and Port 域名和端口Server Comment 虚拟主机说明 Document Root 主目录Aliases 域名别名Webmaster Email Address 服务器管理员emailClone server 克隆其他的虚拟主机设置

Create Virtual Server 创建成功 点击home图标 就会看到你新建成功的虚拟主机,选择他。按start 在浏览器输入http://domain.com 成功的话就可以访问了

 

8、设置Zeus支持php

 

选择 刚刚新建的虚拟主机,configure

API Support FastCGI FastCGI Configuration 选择Enabled Directory name : /usr/local/bin/phpLocation: Machine name: localhost 8002Additional methods supported?:None 点击apply按钮进URL Handling中的Handlers设置。在Handlers中设置以下参数:File Extension : phpSpecify the path and filename of the handler, relative to the document root : /usr/local/bin/phpHTTP 404 errors are handled by : The handler 点击apply按钮 进URL Handling中的Directory Requests

加上index.php

连上终端,su 编成rootcd /usr/local/zeus/rc.dvi S05php

加入以下内容:

 

#!/bin/sh # Script to start and stop the persistent PHP runner for FastCGI. # Please check paths before use. # FastCGI PHP binary FPHPBIN=/usr/local/bin/php # Location to place semaphore SEMFILE=/tmp/php.pid PHP_FCGI_CHILDREN=100 PHP_FCGI_MAX_REQUESTS=1000 export PHP_FCGI_CHILDREN export PHP_FCGI_MAX_REQUESTS # This is Linux - use /proc to increase the local (ephemeral) port range #echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range if [ -z "$ZEUSHOME" ] then cd `dirname $0`/.. ZEUSHOME=`pwd` export ZEUSHOME fi case "$1" in 'start') if [ -e $SEMFILE ] then echo FastCGI PHP error: already running.Restart FastCGI PHP now kill `cat $SEMFILE` sleep 5 fi if [ ! -x $FPHPBIN ] then echo FastCGI PHP error: please check that $FPHPBIN is executable and exists. exit 1 fi echo Starting FastCGI PHP. $ZEUSHOME/web/bin/fcgirunner --user=65534 --group=65534 --pidfile=$SEMFILE 8002 $FPHPBIN ;; 'stop') if [ -e $SEMFILE ] then echo Stopping FastCGI PHP. kill `cat $SEMFILE` rm $SEMFILE exit 0 fi ;; 'restart') if [ -e $SEMFILE ] then echo Stopping FastCGI PHP. kill `cat $SEMFILE` sleep 5 fi echo Starting FastCGI PHP. $ZEUSHOME/web/bin/fcgirunner --user=65534 --group=65534 --pidfile=$SEMFILE 8002 $FPHPBIN ;; *) echo "usage: $0 {start|stop|restart}" ;; esac exit 1

在这个脚本中有以下内容需要视系统情况而修改: FPHPBIN=/usr/local/php/bin/php 应设置为php的路径 SEMFILE=/tmp/php.pid 生成php.pid的路径,该目录必须可写 PHP_FCGI_CHILDREN=100 php进程数目 PHP_FCGI_MAX_REQUESTS=1000 每个php的进程在退出前能够响应的请求数,用于释放资源 上面两个根据硬件配置和网站访问量设置,默认值是8,500。 一般来说 PHP_FCGI_CHILDREN > 访问并发最大值+10 PHP_FCGI_MAX_REQUESTS 如果设置过小,访问量大的网站会因为php进程重起频繁增加负荷。 #echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range 只用于linux --user=65534 --group=65534 为php进程运行的用户和组,一般设置为nobody用户和组FreeBSD是65534/65534,Linux是99/99保存!chmod 750 S05phpcd .../restart-zeus一但启动后就会在ps -ax列表中显示出PHP_FCGI_CHILDREN+1个php进程。

 

到你的vhost对应的Docroot目录中建一个info.php文件,内容为:

 

使用浏览器访问vhost中的info.php文件,应该就可以看到PHP的info页面了 后面的懒得写了,网上freebsd php howto直接复制了:) zeus后台非常强大,大家自己去捉摸把。