专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 应用服务器

安装Lighttpd并在其下安装PHP,该怎么处理

发布时间:2010-06-14 17:11:31 文章来源:www.iduyao.cn 采编人员:星星草
安装Lighttpd并在其下安装PHP
原地址:http://doc.zenw.org/linux/ch02s03.html#id2844165 


Lighttpd 

一个好用的轻巧的webservice 


编译安装 

-- 1.下载 -- 

下载相关软件 


$ sudo apt-get install libpcre3* 


cd /usr/local/src/ 

wget http://www.lighttpd.net/download/lighttpd-1.4.15.tar.gz 

tar zxvf lighttpd-1.4.15.tar.gz 

cd lighttpd-1.4.15 


-- 2.安装 -- 

编译安装 


./configure --prefix=/usr/local/lighttpd-1.4.15 \ 

--with-bzip2 \ 

--with-memcache 

make 

make install 


-- 3.创建目录与配置文件 -- 

创建目录与配置文件 

ln -s /usr/local/lighttpd-1.4.15/ /usr/local/lighttpd 

mkdir -p /www/pages 

mkdir /www/logs 

mkdir /usr/local/lighttpd/htdocs 

mkdir /usr/local/lighttpd/logs 

mkdir /usr/local/lighttpd/etc 

cp ./doc/lighttpd.conf /usr/local/lighttpd/etc/ 

cd /usr/local/lighttpd/ 


-- 4.修改配置文件 -- 

配置lighttpd.conf 

vi etc/lighttpd.conf 

找到 server.modules 

删除 mod_fastcgi 前的注释 

跟据你的需求修改下面定义 

server.document-root = "/usr/local/lighttpd/htdocs/" 

server.errorlog = "/usr/local/lighttpd/logs/lighttpd.error.log" 

accesslog.filename = "/usr/local/lighttpd/logs/access.log" 

注释 $HTTP["url"] 

#$HTTP["url"] =~ "\.pdf$" { 

# server.range-requests = "disable" 

#} 


-- 5.运行 -- 

运行lighttpd 

/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf 


测试 

curl http://ip/ 因为/www/pages/下没有HTML页面所以返回: 

404 - Not Found 


-- 6.制作启动脚本 -- 

每次启动lighttpd时我们要指定配置文件的位置,停止lighttpd时要先找到进程号,然后用kill发送停止信号,有点太麻烦了。好在 lighttpd自带了一个脚本程序能辅助完成这些操作,只要稍微改改就能用了,那就是源码目录doc/rc.lighttpd和doc /rc.lighttpd.redhat,后者专用于RedHat Linux。主要的改动之处在于: 

... 
if [ -z "$LIGHTTPD_CONF_PATH" ]; then 
LIGHTTPD_CONF_PATH="/usr/local/lighttpd-1.4.9/lighttpd.conf" 
fi 
... 
lighttpd="/usr/local/lighttpd-1.4.9/usr/sbin/lighttpd" 
... 

用这个脚本管理lighttpd是不是方便多了。 

-- 7.z.en写的简单的管理脚本 -- 

#!/bin/bash 
# author: z.En Wong <w@zenw.org> 


PREFIX=/usr/local/lighttpd/ 
PROG=$PREFIX/sbin/lighttpd 
OPTIONS=" -f /usr/local/lighttpd/lighttpd.conf" 
restart(){ 
  stop 
  start 




start(){ 

  $PROG$OPTIONS 

stop(){ 
  PID=`pidof lighttpd` 
  kill $PID 



case "$1" in 
  stop) 
  stop 
  ;; 
  start) 
  start 
  ;; 
  restart) 
  restart 
  ;; 
  *) 
  echo "{start|stop|restart}" 
esac 



安装PHP(FastCGI) 

-- 1. 下载PHP -- 

  cd /usr/local/src/ 
  wget http://cn2.php.net/get/php-5.2.3.tar.bz2/from/cn.php.net/mirror 
  tar jxvf php-5.2.3.tar.bz2 
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: