官网:
http://www.lighttpd.net/
http://www.cronolog.org
# 安装依赖包
yum -y install libevent libcurl gamin-devel pcre-devel zlib-devel bzip2-devel python-pycurl
# 安装lighttpd
cd /usr/local/src
tar xf lighttpd-1.4.35.tar.gz
cd lighttpd-1.4.35
./configure --with-fam --with-bzip2 --with-zlib --with-pcre
make
make install
# 安装cronlog日志 切割
tar -zxvf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure
make
make install
# 安装cgi
tar xf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
make install
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
错误解决:
make时候遇见报错
fcgio.cpp: In destructor ‘virtual fcgi_streambuf::~fcgi_streambuf()‘:
fcgio.cpp:50:14: error: ‘EOF‘ was not declared in this scope
fcgio.cpp: In member function ‘virtual int fcgi_streambuf::overflow(int)‘:
fcgio.cpp:70:72: error: ‘EOF‘ was not declared in this scope
fcgio.cpp:75:14: error: ‘EOF‘ was not declared in this scope
fcgio.cpp: In member function ‘virtual int fcgi_streambuf::sync()‘:
fcgio.cpp:86:18: error: ‘EOF‘ was not declared in this scope
fcgio.cpp:87:41: error: ‘EOF‘ was not declared in this scope
fcgio.cpp: In member function ‘virtual int fcgi_streambuf::underflow()‘:
fcgio.cpp:113:35: error: ‘EOF‘ was not declared in this scope
解决方法: 修改源码include/fcgio.h 包含头文件#include <cstdio>,在make && make install,问题解决。
# 检测lighttpd配置 文件语法
/usr/local/sbin/lighttpd -f /data0/test.com/conf/lighttpd.conf -t
# 启动
/usr/local/sbin/lighttpd -f /data0/test.com/conf/lighttpd.conf
# 配置文件示例:
# vim lighttpd.conf
server.modules = (
"mod_alias",
"mod_access",
"mod_fastcgi",
"mod_extforward",
"mod_accesslog" )
server.document-root = "/data0/test.com/wwwroot/"
extforward.forwarder = (
"1.1.1.1" => "trust",
"2.2.2.2" => "trust"
)
server.errorlog = "/data0/log/test.com/error.log"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jar" => "application/x-java-archive",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
# default mime type
"" => "application/octet-stream",
)
accesslog.filename = "|/usr/local/sbin/cronolog /data0/log/test.com/access.log.%Y%m%d"
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
alias.url += (
"/cgi-bin/" => "/data0/test.com/cgi-bin/"
)
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
server.port = 81
fastcgi.server = (
"query_isp.fcgi" => (
"localhost" => (
"socket" => "/tmp/query_isp.socket",
"bin-path" => "/data0/test.com/cgi-bin/query_isp.fcgi",
"min-procs" => 20,
"max-procs" => 20,
"max-load-per-proc" => 100,
"idle-timeout" => 20,
)
),
"iplookup.fcgi" => (
"localhost" => (
"socket" => "/tmp/iplookup.socket",
"bin-path" => "/data0/test.com/cgi-bin/iplookup.fcgi",
"min-procs" => 20,
"max-procs" => 20,
"max-load-per-proc" => 100,
"idle-timeout" => 20,
)
)
)原文地址:http://wupengfei.blog.51cto.com/7174803/1958126