Lighttpd php fastcgi Windows 安装 lighttpdWindowsPHPCGIQt
其实安装Lighttpd不需要什么别的软件,去https://www.kevinworthington.com/?s=lighttpd下载编译好的win32版就好了(本人用的是zip包,exe版类似)。
1.解压到任何目录(最好是英文目录,其他语言的没试过),如d:\inetpub\LightTPD;我的系统环境:Vista32 中文版,PHP5.2.3和5.2.4,mysql 5.0.45;
以下的conf、bat和RunHiddenConsole.exe可以在这里下载:http://www.box.net/shared/vfvqyjhday
2.打开conf文件夹,将lighttpd-inc.conf备份;
3.修改这个配置文件,我的配置如下(精简过的)#后面的是注释,详细注释前往官方文档http://trac.lighttpd.net/trac/wiki/Docs及本论坛的好帖http://www.lighttpd.net.cn/showthread.php?t=11217:
var.root="D:/Inetpub/Lighttpd"
#启用的modules(详细见原版lighttpd-inc.conf)
server.modules=(
"mod_access",
"mod_cgi",
"mod_accesslog",
"mod_alias",
#"mod_fastcgi"
)
#服务的目录
server.document-root="D:/Inetpub/www/"
server.errorlog=var.root+"/logs/lighttpd.error.log"
server.upload-dirs=(var.root+"/tmp")
accesslog.filename=var.root+"/logs/access.log"
#默认首页
index-file.names=("index.php","index.html","index.htm")
#使用php
static-file.exclude-extensions=(".php")
#使用CGIphp的定义
cgi.assign=(".php"=>"D:/Inetpub/php/php-cgi.exe")
#使用fastcgiPHP(win版下可使用)
#fastcgi.server=(".php"=>("localhost"=>("host"=>"127.0.0.1","port"=>521)))
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"
)
#虚拟目录
alias.url=("/ma/"=>"D:/Inetpub/ma/")
#侦听端口
server.port=81
mimetype.use-xattr="enable"
#无首页是否列文件目录
dir-listing.activate="enable"
#服务器的版本好(好像是列目录时显示的)
server.tag="lighttpd/1.4.18i-win32"
url.access-deny=("~",".inc")
$HTTP["url"]=~".pdf$"{
server.range-requests="disable"
}
4.写运行Lighttpd的批处理文件放在lighttpd的根目录下:
运行CGI php:
start_lighttpd - cgi.bat
ECHOStartinglighttpd...
#重点是这句,-m指定mod文件的位置(一般不需要修改),-f指定配置文件的位置
LightTPD.exe-mlib-fconflighttpd.conf
IF%errorlevel%GTR0(
ECHOStartinglighttpdfailed!
PAUSE
)ELSE(
ECHOStartinglighttpdsucceed!
)
运行fastcgi php:
a.先确保在conf中使用mod_fastcgi,和配置了fastcgi.server;
b.start_lighttpd - fastcgi.bat,RunHiddenConsole.exe 在官方网站有下(也可以不使用,不过回留下一个cmd的窗口)
ECHOStartingPHPFastCGI...
#运行php-cgi.exe
RunHiddenConsole.exe..PHPphp-cgi.exe-b127.0.0.1:521
ECHOStartingLightTPD...
ECHO.
lighttpd.exe-v
ECHO.
lighttpd.exe-fetclighttpd.conf-mlib
EXIT
关闭Lighttpd:
stop_lighttpd - cgi.bat
ECHOStopinglighttpd...
binProcess-kLightTPD.exe
ping127.0.0.1>NUL
stop_lighttpd_fastcgi.bat
ECHOStoppingLightTPD...
binprocess.exe-klighttpd.exe>nul
ECHOStoppingPHPFastCGI...
binprocess.exe-kphp-cgi.exe>nul
ECHO.
EXIT
重启Lighttpd:
restart_lighttpd.bat
CALLstop_lighttpd.bat
CALLstart_lighttpd.bat
5.也可以去bin目录把lighttpd配置成windows的系统服务。
备注:
运行fastcgi模式的时候,可以把批处理改成这样,没有CMD窗口。
这个编译过的lighttpd的配置文件被改成lighttpd-inc.conf了。所以下面要改一下。
ECHOStartingPHPFastCGI...
#运行php-cgi.exe
RunHiddenConsole.exe..PHPphp-cgi.exe-b127.0.0.1:521
ECHOStartingLightTPD...
ECHO.
lighttpd.exe-v
ECHO.
RunHiddenConsole.exelighttpd.exe-flighttpd-inc.conf -mlib
EXIT
<!-- / message --><!-- edit note -->
推荐阅读
-
Lighttpd php fastcgi Windows 安装 lighttpdWindowsPHPCGIQt
-
Windows下PHP与Apache的安装与配置 博客分类: PHPWeb Server apachephp
-
windows7 php5.3 +zend guard loader 安装 zendphpwindowsapache
-
zend server ce 安装 windows linux 博客分类: php zendserverlinuxwindows安装
-
Windows 下安装 swoole 图文教程(php)
-
Windows 下安装 swoole 图文教程(php)
-
PHP7安装Redis扩展教程【Linux与Windows平台】
-
Windows2003下php5.4安装配置教程(IIS)
-
Windows2003下php5.4安装配置教程(Apache2.4)
-
windows server 2008/2012安装php iis7 mysql环境搭建教程