CentOS Linux系统搭建Cherokee+php+mysql环境

  Cherokee号称是目前最快的 Web 服务器软件,Cherokee 的功能包括支持 FastCGI、SCGI、PHP、CGI、TLS 及 SSL 加密连接,虚拟主机,授权认证,实时编码,载入均衡,与 Apache 兼容的 log 文件等等。Cherokee 内含一个名为 cherokee-admin 的工具,执行后,允许管理员直接通过浏览器进入 :9090/ 对其进行管理和配置。比如,开启或关闭服务器,进行一般选项的设定,配置虚拟服务器、信息源、图标、Mime 类型等项目。下面以centos 5.5 32位系统为例介绍如何安装cherokee php mysql,以及Cherokee配置虚拟主机支持PHP的过程。

编译安装mysql

安装所需软件

# yum -y install make gcc gcc-c++ ncurses-devel
# rpm -Uvh

下载软件

# cd /tmp
# wget -c ://mysql.he.net/
# wget -c
# wget -c

安装cmake和bison

# cd /tmp
# tar zxvf cmake-2.8.6.tar.gz
# cd cmake-2.8.6
# ./bootstrap
# make && make install
# cd /tmp
# tar zxvf bison-2.5.tar.gz
# cd bison-2.5
# ./configure
# make && make install

开始安装mysql

# /usr/sbin/groupadd mysql
# /usr/sbin/useradd -g mysql mysql
# cd /tmp
# tar xvf mysql-5.5.17.tar.gz
# cd mysql-5.5.17/

编译安装 

# cmake -dcmake_install_prefix=http://down.chinaz.com/usr/local/mysql \
-dmysql_unix_addr=http://down.chinaz.com/tmp/mysql.sock \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-dwith_extra_charsets:string=utf8,gbk,gb2312 \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=http://down.chinaz.com/var/mysql/data \
-dmysql_user=mysql
# make && make install

一些相关设置

# chmod +w /usr/local/mysql
# chown -R mysql:mysql /usr/local/mysql
# ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
# mkdir -p /var/mysql/
# mkdir -p /var/mysql/data/
# mkdir -p /var/mysql/log/
# chown -R mysql:mysql /var/mysql/
# cd support-files/
# cp my-medium.cnf /var/mysql/my.cnf
# cp mysql.server /etc/rc.d/init.d/mysqld

初始化mysql

# /usr/local/mysql/scripts/mysql_install_db \
--defaults-file=http://down.chinaz.com/var/mysql/my.cnf \
--basedir=http://down.chinaz.com/usr/local/mysql \
--datadir=http://down.chinaz.com/var/mysql/data \
--user=mysql

# chmod +x /etc/init.d/mysqld

# vi /etc/init.d/mysqld(编辑此文件,查找并修改以下变量内容:)

basedir=http://down.chinaz.com/usr/local/mysql
datadir=http://down.chinaz.com/var/mysql/data
chkconfig --add mysqld
chkconfig --level 345 mysqld on
service mysqld start
/usr/local/mysql/bin/mysqladmin password [new-password]编译安装PHP

安装必要软件包

# yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel autoconf pcre-devel libtool-libs freetype-devel gd libmcrypt-devel zlib-devel zip unzip gettext

开始安装php

# cd /tmp
# groupadd www
# useradd -s /sbin/nologin -g www www
# wget -c
# tar xzvf php-5.3.8.tar.gz
# cd php-5.3.8

编译安装php 

# ./configure --prefix=http://down.chinaz.com/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=http://down.chinaz.com/etc --with-config-file-scan-dir=http://down.chinaz.com/etc/php.d --with-libxml-dir --with-openssl --with-zlib --with-curl --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --with-gettext --enable-mbstring --with-mcrypt --with-mysql=http://down.chinaz.com/usr/local/mysql --with-mysqli=http://down.chinaz.com/usr/local/mysql/bin/mysql_config --without-pear
# make && make install

# cp php.ini-production /etc/php.ini
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# cp sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf

编辑php-fpm.conf,找到如下字段,删除前面的";"号

pid = run/php-fpm.pid
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35

找到:

listen = 127.0.0.1:9000

改为:

listen = /tmp/php-cgi.sock
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig --level 345 php-fpm on
/etc/init.d/php-fpm start编译安装cherokee# yum -y install rrdtool
# groupadd www
# useradd -s /sbin/nologin -g www www
# wget -O -| tar zxvf -
# cd cherokee-1.2.101

编译安装cherokee

# ./configure --prefix=http://down.chinaz.com/usr/local/cherokee --with-wwwroot=http://down.chinaz.com/home/www --with-wwwuser=www --with-wwwgroup=www
# make && make install

# wget -O /etc/init.d/cherokee
# chmod +x /etc/init.d/cherokee
# chkconfig --add cherokee
# chkconfig --level 345 cherokee on
# ln -s /usr/local/cherokee/sbin/cherokee-admin /usr/sbin/
# service cherokee start

  现在你已经可以访问默认的chreokee页面,执行cherokee-admin -b命令得到后台密码,并通过localhost:9090进入后台。

Cherokee配置虚拟主机支持PHP

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10950.html