分类: 电脑技术
作者: admin

Ubuntu 上安装及配置 Cherokee , 号称最快的 Web 服务器

Cherokee 号称是目前最快的 Web 服务器软件,据说在性能上甚至比 Nginx 还略胜一筹。

Cherokee 的功能包括支持 FastCGI、SCGI、PHP、CGI、TLS 及 SSL 加密连接,虚拟主机,授权认证,实时编码,载入均衡,与 Apache 兼容的 log 文件等等。

Cherokee 最具特色的地方在于内置了一个名为 cherokee-admin 的工具,执行后,允许管理员直接通过浏览器对其进行管理和配置。比如,开启或关闭服务器,进行一般选项的设定,配置虚拟服务器、信息源、图标、Mime 类型等项目。另外还集成了 RRD-tool 工具,无需任何配置就可以生成服务器流量表等监控数据。

screenshot-000-13070923.png

项目主页:http://www.cherokee-project.com/

# 安装:

通过这个 PPA 源来安装最新版的 Cherokee 1.0.5

sudo apt-get install rrdtool
sudo apt-get install libcherokee-mod-rrd
sudo apt-add-repository ppa:cherokee-webserver/ppa
sudo apt-get update
sudo apt-get install cherokee

# 启动:

Cherokee Web 服务:

sudo /etc/init.d/cherokee start

Cherokee 后台管理程序:

sudo cherokee-admin -b 192.168.0.1

请把 192.168.0.1 替换你自已主机的外网 IP 地址,这样在远程也可以访问后台管理界面了。

启动后会出现类似下面的提示:

Login:
User: admin
One-time Password: lKNmYl9cHO87Z45C

Web Interface:
URL: http://localhost:9090/

它会生成一个一次性密码,通过这个密码就可以登录管理界面了,每次重启管理程序密码都会改变。

# 后台截图:

主界面

screenshot-000-12070951.png

流量监控画面

screenshot-000-12070953.png

Cherokee 是一个非常快速,灵活和易于配置的Web Server.它支持现今普遍的技术:FastCGI, SCGI, PHP, CGI, TLS and SSL 加密连接, virtual hosts, authentication, on the fly encoding, load balancing, Apache compatible log files, and much more. 本教程演示如何安装 Cherokee 在Ubuntu 10.04 服务器上PHP5(through FastCGI) and MySQL 的问题.

安装 Cherokee

Cherokee可以通过配置一个基于Web的控制面板,我们可以开始如下:

cherokee-admin -b

(默认 cherokee-admin 登录 127.0.0.1 (localhost))

root@server1:~# cherokee-admin -b

Login:
User:              admin
One-time Password: gU7dYa7zq31yjC6p

Web 连接:
URL:               http://localhost:9090/

[12/05/2010 17:42:12.448] (error) rrd_tools.c:114 - Could not find the rrdtool binary.
Cherokee Web Server 0.99.39 (Feb  2 2010): Listening on port ALL:9090, TLS
disabled, IPv6 disabled, using epoll, 4096 fds system limit, max. 2041
connections, caching I/O, single thread

你需要的用户名和密码登录到网络接口,可以找到

http://192.168.0.100:9090/:

用户名和密码登录到网络接口

这是如何在网络界面:

cherokee网络界面

停止 cherokee-admin, 按CTRL+C中断.

4 安装 PHP5

在Cherokee上安装php5可以跑FastCGI, Ubuntu  FastCGI-enabled PHP5 安装包进行安装:

aptitude install php5-cgi

5 配置 PHP5

修改 /etc/php5/cgi/php.ini 和添加  cgi.fix_pathinfo = 1

vi /etc/php5/cgi/php.ini

[...]
cgi.fix_pathinfo = 1

重启 Cherokee:

/etc/init.d/cherokee restart

6 启动 PHP5 在 Cherokee上

PHP 默认没有启动在 Cherokee . 要启用它, 重新启动 Cherokee’s web-based 控制面板…

cherokee-admin -b

… 登录 (http://192.168.0.100:9090/).

查看 Virtual Servers, 选择默认的虚拟主机:

查看 Virtual Servers, 选择默认的虚拟主机

单击向导按钮:

单击向导按钮

Under Wizards > Languages,单击运行向导旁边的连结PHP图标:

Under Wizards > Languages,单击运行向导旁边的连结PHP图标:

PHP的现在应该列在行为标签. Make sure you mark its checkbox in the Final column:

PHP的现在应该列在行为标签.

通过点击链接在目标的PHP专栏,你可以改变,如果你喜欢默认的PHP设定(这是没有必要,默认设置应该是在大多数情况 cases).对FastCGI 设置选项卡上的处理程序:

点击链接在目标的PHP专栏

在你离开控制面板, 必需重新启动Cherokee 才能更生效 effect. 这样做, 选择Graceful在重新启动控制面板,并点击左边栏保存在保存的变化:

重新启动Cherokee

按Ctrl + C命令行停止控制面板。

7 测试 PHP5 / Getting 关于详细信息 PHP5 安装

默认的Web站点的根文件 /var/www.我们现在将创建一个小型PHP文件(info.php) .

 

该文件将显示我们的PHP安装,如安装的PHP版本,很多有用的细节。

vi /var/www/info.php

<?php
phpinfo();
?>

在地址输入 (e.g. http://192.168.0.100/info.php):

php信息

知道 PHP5 在工作, and it’s working through FastCGI, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don’t have MySQL support in PHP5 yet.

8 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It’s a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

aptitude search php5

Pick the ones you need and install them like this:

aptitude install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

Now restart Cherokee:

/etc/init.d/cherokee restart

Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

php5

9 Links