操作系统 :CentOS5.3--(Linux version 2.6.18-128.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Jan 21 10:41:14 EST 2009)
lighttpd :1.4.23
一、Download and install lighttpd
# cd /opt
# wget [http://www.lighttpd.net/download/lighttpd-1.4.23.tar.gz]
# tar jxvf lighttpd-1.4.23.tar.gz
# cd lighttpd-1.4.23
# ./configure --prefix=/usr/local/lighttpd
some error as this:
configure: error: pcre-config not found, install the pcre-devel package or bui with --without-pcre
configure: error: zlib-headers and/or libs where not found, install them or build with --without-zlib
二、Install all nessary development libraries
You need to install following libraries to compile required modules and features:
- glib2-devel : Gnome header files for version 2 of the GLib library
- openssl-devel – Used by core and SSL support
- pcre-devel - Used by mod_redirect, mod_rewrite,
- bzip2-devel - Use by compress-bzip2
- zlib-devel - Used by compress-gzip and compress-deflate. It contains the header files and libraries.
yum install gcc glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel zlib-devel
三、install
# ./configure --prefix=/usr/local/lighttpd
# make
# make install
四、Configure lighttpd
# cp doc/sysconfig.lighttpd /etc/sysconfig/lighttp
拷贝配置文件
# mkdir /etc/lighttpd
# cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
修改配置文件服务路径
# mkdir -p /www/yoursite/data1
# vi /etc/lighttpd/lighttpd.conf
server.document-root = "/srv/www/htdocs/" -> server.document-root = "/www/yoursite/data1"
拷贝启动脚本
# cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd
修改启动脚本中的lighttpd的安装位置
# vi /etc/init.d/lighttpd
lighttpd="/usr/sbin/lighttpd" -> ighttpd="/usr/local/lighttpd/sbin/lighttpd"
看是否能启动
# /etc/init.d/lighttpd start
可能会出现opening errorlog '/var/log/lighttpd/error.log' failed: No such file or directory
日志文件不存在,设置一个正确的路径就好了。
# mkdir -p /var/log/lighttpd
添加到开机自动启动服务
# chkconfig lighttpd on