CentOS编译安装LIGHTTPD /ZEUS /NGINX

系统 Linux
我我们就需要用到一个程序来自CentOS编译安装LIGHTTPD的swawn-fcgi

你们知道什么是CentOS编译安装么这个非常高深的运用技术将由我来非常讲解,CentOS编译安装NB在哪呢,下面我来进入讲述CentOS编译安装的无限领域。我们在这里CentOS编译安装LIGHTTPD /ZEUS /NGINX 先是LIGHTTPD 下载源码包/解压/CentOS编译安装LIGHTTPD装到/usr/local/LIGHTTPD

cd /tmp wget http://www.LIGHTTPD.net/download/LIGHTTPD-1.4.18.tar.gz tar zxvf LIGHTTPD-1.4.18.tar.gz cd LIGHTTPD-1.4.18 ./configure --prefix=/usr/local/LIGHTTPD make make install cp doc/LIGHTTPD.conf /etc
#复制配置文件到/etc目录下

修改/etc/lihttpd.conf如下: 在server.modules 下面找到"mod_fastcgi",将这行前面的#去掉 修改server.document-root 后面的目录为网站根目录..比如"/var/www/html" 并在下面添加

fastcgi.server= ( ".php" =>( "localhost" =>("socket" => "/tmp/php-fastcgi.socket","bin-path" => "/usr/local/php4-cgi/bin/php")如果是php5那bin-path对应的就是/usr/local/php5-cgi/bin/php-cgi 随便你选择一个版本.. 在运行LIHTTPD之前...先添加LOG目录.否则出错mkdir /var/log/LIGHTTPD自此 LIHTTPD安装完 [应用的时候.强烈建议你强制LIGHTTPD运行在非ROOT用户下.方法是修改/etc/LIGHTTPD.conf相应的USER/GROUP值.这应该不难理解.

复制个启动脚本...但需要手动修改一点.cp /tmp/LIGHTTPD-1.4.18/doc/rc.LIGHTTPD.redhat        /etc/rc.d/init.d/LIGHTTPD修改LIGHTTPD_CONF_PATH=值为"/etc/LIGHTTPD.conf" 修改LIGHTTPD=值为"/usr/local/LIGHTTPD/sbin/LIGHTTPD"service LIGHTTPD start|stop|......跟着轮到CentOS编译安装Nginx了..

下载/解压/CentOS编译安装LIGHTTPD

cd /tmp/ wget http://sysoev.ru/nginx/nginx-0.5.34.tar.gz tar zxvf nginx-0.5.34.tar.gz cd nginx-0.5.34 ./configure --prefix=/usr/local/nginx make make install cp conf/fastcgi_params /usr/local/nginx/conf #复制FASTCGI配置头到配置文件目录echo"fastcgi_param SCRIPT_FILENAME"$document_root"$fastcgi_script_name;">>/usr/local/nginx /conf/fastcgi_params #添加一个配置头,没它可不行!!!这时,我们需要NGINX外挂一个FASTCGI进程来运行PHP. 这样.我们就需要用到一个程序来自CentOS编译安装LIGHTTPD的swawn-fcgi

cp /usr/local/LIGHTTPD/bin/spawn-fcgi /usr/local/nginx/sbin在运行NGINX之前.我们需要先运行这个FCGI程序. 具体参数如下: spawn-fcgi -f [PHP程序路径] -p [监听端口] -C [多少个进程] -P [PID文件存放地址] -u [用户名] -g [组名] 结合我们的就是/usr/local/nginx/sbin/spawn-fcgi -f /usr/local/php4-cgi/bin/php -p 8008 -C 20 -u nobody -g nobody -a 127.0.0.1这时我们需要配置nginx的配置文件/usr/local/nginx/conf/nginx.conf 下面是我的一个例子,大家可以参考一下

user nobody; worker_processes 2; error_log logs/error.log info; #pid logs/nginx.pid; worker_rlimit_nofile 2048; events {use epoll; worker_connections 2048; } http {include conf/mime.types;default_type application/octet-stream;#tcp_nopush on;keepalive_timeout 60;#gzip on;server{listen83;#这里修改监听端口server_name localhost;ndex index.html index.htm index.php;root/var/www/html;#这里修改网站根目录location ~ .*".php?${include conf/fastcgi_params;fastcgi_pass127.0.0.1:8008;#8008端口要与FCGI监听端口一致fastcgi_index index.php;}这时我们需要注意权限问题了.有三个地方, 一是PHPFCGI运行用户,二CentOS编译安装NGINX运行用户身份,三是网站目录的身份.. 如果运行有什么出错的话.请先检查这些权限问题 现在我们就可以运行了

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf另外.我也随便改做了一个nginx的启动脚本/etc/rc.d/init.d/nginx#!/bin/bash # v.0.0.1 # create by jackbillow at 2007.10.15 # nginx - This shell script takes care of starting and stopping nginx. # # chkconfig: - 60 50 # description: nginx [engine x] is light http web/proxy server # that answers incoming ftp service requests. # processname: nginx # config: /usr/local/nginx/conf/nginx.conf nginx_path="/usr/local/nginx" nginx_pid="/usr/local/nginx/logs/nginx.pid" fcgi_pid="/var/run/fcgi.pid" # Source function library../etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x

$nginx_path/sbin/nginx ] || exit 0 RETVAL=0 prog="nginx" start() { # Start daemons. if [ -e $nginx_pid -a ! -z $nginx_pid ];then echo "nginx already running...." exit 1 fi if [ -e $nginx_path/conf/nginx.conf ];then   echo -n $"Starting $prog: "   $nginx_path/sbin/nginx -c $nginx_path/conf/nginx.conf   $nginx_path/sbin/spawn-fcgi -a 127.0.0.1 -p 8008 -C 15 -u nobody -f /usr/local/php-cgi/bin/php -P $fcgi_pid 2>/dev/null

#如果要修改PHP的版本.请更改 -f后面的参数RETVAL=$? [ $RETVAL -eq 0 ] && { touch /var/lock/subsys/$prog success $"$prog" } echo else RETVAL=1 fi return $RETVAL } # Stop daemons. stop() {     echo -n $"Stopping $prog: "#killproc -d 10 $nigx_path/sbin/nginxNGINXPID=`cat "$nginx_pid"` 2>dev/nullFCGIPID=`cat "$fcgi_pid"` 2>/dev/null/bin/kill "$FCGIPID" 2>/dev/null/bin/kill "$NGINXPID" 2>/dev/nullRETVAL=$?echo[ $RETVAL = 0 ] && rm -f $nginx_pid /var/lock/subsys/$prog } # See how we were called. case "$1" in start)start;; stop)stop;; reconfigure)stopstart;; status)status $progRETVAL=$?;; *)echo $"Usage: $0 {start|stop|reconfigure|status}"exit

1 esac exit $RETVAL同时要设置运行权限chmod 755 /etc/rc.d/init.d/nginx至此.CentOS编译安装NGINX基本完成!最后一个是zeus.其实ZEUS是最容易安装的. 我就方便大家.转些资料过来吧... 以下内容部分摘自http://www.discuz.net/viewthread.php?tid=85432Discuz作者Crossday的 Zeus 4.3+php+Zend Optimizer for Linux安装指南(第二版)在网上找到ZEUS4.3的破解文件及原文件.[我的是朋友发给我的.所以无法提供给大家] 我得到的文件是Zeus_43_Linux.zipcd /tmp unzip Zeus_43_Linux.zip cd Zeus_43_Linux tar zxvf Zeus_43_Linux-x86.tgz#里面有这个压缩文档 cd Zeus_43_linux-x86 ./zinstall

按CTRL+C 打入accept Where should the product be installed? [/usr/local/zeus]: 回车 Installation options: 1. Full install of both admin server & web server 2. Stand-alone install of admin server 3. Clustered install of web server H. Help Choose installation option [1]: 回车 Enter the key filename, or leave blank for unlicensed mode: /tmp/Zeus_43_Linux/license.key (这里的 key 是假的,但要存在,文件就在刚刚解压的ZIP下面,真正的破解在之后覆盖二进制程序中进行) Please choose a password for the admin server: ****** (输入管理员密码) Re-enter: ****** (重新输入密码) 然后一直按回车就OK了 以上是安装过程 很容易的就装好了 下面进行破解

rm -f /usr/local/zeus/web/bin/zeus.web    cp -f /tmp/Zeus_43_Linux/zeus.web /usr/local/zeus/web/bin/zeus.web    chmod 755 /usr/local/zeus/web/bin/zeus.web rm -f /usr/local/zeus/php/php.zeus        #删除ZEUS自带的PHP ln -s /usr/local/php5-cgi/bin/php-cgi /usr/local/zeus/php/php.zeus   #给我们的PHP做一个符号连接,选择哪一个PHP版本.由这里决定 service zeus restart                    #重启ZEUS[ZEUS自带有脚本...service zeus start|stop|restart]
设置Zeus 访问 http://your.com:9090 (你的域名地址或IP地址) 用户名 admin 密码:刚才设定的密码

进入Zeus管理控制台,点Create a Virtual Server 把相关的六个选项填好 不多说 注意:1. 指向的web目录要有权限读 2. 如果在 Host Name and Port 写域名,请确定该域名是绑定到当前IP的,否则请填写当前服务器IP地址 另外我们要注意绑定的端口..不要与其它WEBSERVER冲突..我们使用84端口了! 进入刚刚加入的virtual server,点Third Party中的PHP Enabling PHP Support:选 Enabled

将 Specify the maximum number of PHP processes that should be created for each user: 由默认的 8 改为 5将 Specify the maximum number of requests that an individual PHP process should handle. This prevents errant PHP processes from consuming too much memory. 由默认的 500 改为 200其实这样仍然能够相应 5*200=1000个并发PHP请求了,足矣。 Apply Changes,然后点上面的 This configuration has been modified. Click here for details or to make it take effect. 然后 Commit

点左边Url Handling下面的Directory Requests Index Files中的内容为 index.html, index.htm, index.shtml, index.cgi, index.php 如果不需要 index.shtml, index.cgi,可以将其去掉 !!重要!!下面的 Directory Listing,一定要Disabled,不然有安全问题。回到Zeus的9090端口管理界面 把刚才设置的虚拟主机Start,放一个 phpinfo 进去,应该已经可以看到PHP装好了。 自此.ZEUS也基本上安装完成了!!

跟着我们要研究每一个PHP的配置与优化了... 我们先要理解.我们一共有多少个PHP独立配置 共有四个.就是二个PHP.独立模式和CGI模式...配置文件分别位于/usr/local/php4/lib/ /usr/local/php4-cgi/lib/ /usr/local/php5/lib/ /usr/local/php5-cgi/lib/ 我们需要从/tmp/php-4.4.7 和 /tmp/php-5.2.5 目录下复制标准配置文件过去

cp /tmp/php-4.4.7/php.ini-dist /usr/local/php4/lib/php.ini cp /tmp/php-4.4.7/php.ini-dist /usr/local/php4-cgi/lib/php.ini cp /tmp/php-5.2.5/php.ini-dist /usr/local/php5/lib/php.ini cp /tmp/php-5.2.5/php.ini-dist /usr/local/php5-cgi/lib/php.ini首先我们要先修改用于nginx的PHP的PHP.INI 找到 #cgi.fix_pathinfo=0 改为 cgi.fix_pathinfo=1 其它暂时不用理会.
以上介绍CentOS编译安装LIGHTTPD包扩ZEUS /NGINX。

【编辑推荐】

  1. CentOS PHP编译安装4.4.7版和5.2.5版
  2. CentOS基本安装与MYSQL4/APACHE2的安装
  3. CentOS MySQL系统是编译和连接所需要的
  4. 使用vi新建CentOS mytest文件学习c语言编程
  5. CentOS文件建立目录与使用vi测试
责任编辑:佚名 来源: CSDN
相关推荐

2010-01-14 14:32:07

CentOS ligh

2011-02-24 15:04:58

ProftpdCentos

2010-03-05 10:37:20

Ubuntu ligh

2010-02-06 17:08:58

Ubuntu ngin

2010-02-23 14:45:52

CentOS LEMP

2010-01-13 15:07:51

2010-01-13 16:55:10

CentOS PHP安

2010-02-23 13:41:00

2010-01-14 16:53:40

CentOS Apac

2010-01-08 09:43:40

Ubuntu ngin

2010-01-13 16:46:44

CentOS Apac

2010-03-05 09:50:37

Ubuntu ligh

2010-01-13 14:18:36

CentOS Open

2010-04-01 13:37:24

CentOS系统5

2021-01-04 08:15:16

CentOS 7Python3.9Python

2010-01-15 10:16:50

CentOS rpm安

2010-02-24 15:41:19

Linux Light

2010-01-15 17:35:09

2010-01-14 16:27:44

CentOS emes

2010-01-13 10:14:45

点赞
收藏

51CTO技术栈公众号