1、安装pcre 、 zlib 、bzip2
以pcre为例 : ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
tar -zxvf pcre-8.10.tar.gz
cd pcre-8.10
./configure
make
make install
2、安装lighttpd
http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.gz
tar -zxvf lighttpd-1.4.28.tar.gz
cd lighttpd-1.4.28
groupadd lighttpd
useradd –g lighttpd lighttpd
./configure --prefix=/usr/local/lighttpd
make
make install
3、拷贝配置文件
cp -r doc/config /usr/local/lighttpd
4、修改配置文件
var.log_root = "/usr/local/lighttpd/log"
var.server_root = "/var/www"
var.state_dir = "/var/run"
var.home_dir = "/usr/local/lighttpd/sbin/lighttpd"
var.conf_dir = "/usr/local/lighttpd/config"
server.document-root = server_root + "/image" #图片文件存储目录
5、创建启动、关闭服务的脚本文件
检查lighttpd进程 checklighttpd.sh
#!/bin/bash
ps auxww |grep lighttpd|grep -v grep
启动lighttpd服务 startlighttpd.sh
#!/bin/bash
/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/config/lighttpd.conf
关闭lighttpd服务 killlighttpd.sh
#!/bin/bashLIGHTTPD_PID=`ps auxww |grep lighttpd |grep -v grep |awk '{print $2}'`
kill -9 $LIGHTTPD_PID