一.windows下编译配置执行lighttpd
1、下载并安装cygwin。
2、下载lighttpd源码并解压
3、在cygwin环境下进入lighttpd的解压文件夹后,执行:
1> ./configure –prefix=C:/lighthttd
2> make
3> make install
OK,此时在C:/lighthttd中得到的就是编译好的程序,可是不能直接执行,须要从cygwin安装文件夹拷贝一些依赖库:
cyggcc_s-1.dll
cygpcre-0.dll
cygwin1.dll
cyglightcomp.dll
如还有其他的自己依据提示加入,找不到文件的直接搜索。
4.lighttp配置
#lighttpd安装文件夹,切记一定是一个绝对路径,不然fastcgi执行会失败
var.root = "c:\lighttp"
#以下须要启用mod_fastcgi,把前面的"#"号去掉
server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
# "mod_cgi",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )
server.tag = "lighttpd/1.x"
#服务器port号
server.port = 8080
server.document-root = var.root + "\website"
server.errorlog = var.root + "\logs\error.log"
accesslog.filename = var.root + "\logs\access.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",
".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"
)
mimetype.use-xattr = "enable"
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php" )
#设置fast-cgi的执行服务器,依照以下的方式设置,以下的port号,相应php-cgi的启动port号,能够依据须要改动
fastcgi.server = ( ".php" => ( "localhost" => ( "host" => "127.0.0.1", "port" => 1919 )))
上述配置完毕后,保存成lighttpd.conf,放在lighttpd根文件夹就可以。(名字路径你能够随便改)
命令行执行:
lighttpd.exe -D -m lib -f "c:\lighttpd\lighttpd.conf"
有很多其他需求直接看它的命令行帮助,我不介绍了
二.php安装配置执行
假设安装的话,请选择“其他cgi”,非安装版的话有php-cgi.exe就能够了。
改动配置中的:
cgi.fix_pathinfo = 1
命令行执行:
php-cgi .exe -b 127.0.0.1:1919 -c "php.ini"
1919相应lighttpd中的设置
三.mysql不作介绍,下载安装就可以
好了,大功告成,新建php文件測试吧。须要提醒的是,php-cgi程序在执行一定次数的php脚本后会自己主动退出,所以自己写一个维护程序或者去找一个第三方的监视管理程序。