Windows Lighttpd 配置php教程

手游资讯 单机资讯 最近更新 热门排行
您现在的位置:首页 > 软件资讯 > 软件教程 > Windows Lighttpd 配置php教程

Windows Lighttpd 配置php教程

2020-06-17 03:47作者:佚名来源:本站整理浏览:808

LightTPD For Windows是一款HTTP网络服务器。其性能卓异,而且稳定、灵活、高速。其根本的目的是提供一个专门针对高性能网站,安全、快速、兼容性好并且灵活的web server环境。具有非常低的内存开销、cpu占用率低、效能好以及丰富的模块等特点。下面小黑游戏下载就给大家带来了这款软件在Windows系统下搭建方法。

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.修改这个配置文件,我的配置如下(精简过的)#后面的是注释,详细注释前往官方文档

代码:

#定义lighttpd所在目录

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" )

#使用CGI php的定义

cgi.assign = ( ".php" => "D:/Inetpub/php/php-cgi.exe")

#使用fastcgi PHP(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

代码:

@ECHO OFF

ECHO Starting lighttpd...

#重点是这句,-m指定mod文件的位置(一般不需要修改),-f指定配置文件的位置

LightTPD.exe -m lib/ -f conf/lighttpd.conf

IF %errorlevel% GTR 0 (

ECHO Starting lighttpd failed!

PAUSE

) ELSE (

ECHO Starting lighttpd succeed!

)

运行fastcgi php:

a.先确保在conf中使用mod_fastcgi,和配置了fastcgi.server;

b.start_lighttpd - fastcgi.bat,RunHiddenConsole.exe 在官方网站有下(也可以不使用,不过回留下一个cmd的窗口)

代码:

@ECHO OFF

ECHO Starting PHP FastCGI...

#运行php-cgi.exe

RunHiddenConsole.exe ../PHP/php-cgi.exe -b 127.0.0.1:521

ECHO Starting LightTPD...

ECHO.

lighttpd.exe -v

ECHO.

lighttpd.exe -f etc/lighttpd.conf -m lib

EXIT

关闭Lighttpd:

stop_lighttpd - cgi.bat

代码:

@ECHO OFF

ECHO Stoping lighttpd...

bin/Process -k LightTPD.exe

ping 127.0.0.1 > NUL

stop_lighttpd_fastcgi.bat

代码:

@ECHO OFF

ECHO Stopping LightTPD...

bin/process.exe -k lighttpd.exe >nul

ECHO Stopping PHP FastCGI...

bin/process.exe -k php-cgi.exe >nul

ECHO.

EXIT

重启Lighttpd:

restart_lighttpd.bat

代码:

@ECHO OFF

CALL stop_lighttpd.bat

CALL start_lighttpd.bat

5.也可以去bin目录把lighttpd配置成windows的系统服务。

手机福利视频播放器推荐
豆奶视频 丝瓜视频 avbobo 包子视频
秋秋影视 香蕉视频 蜜瓜电影 茄子视频
磁力吧 怡春院 电影港 食色抖音
私密免费观看直播吧 逗别看 唇色直播 影豆网
苦瓜网 尘落电影网 4k屋 火豆电影网

推荐阅读

Tags: 责任编辑:小黑游戏

相关文章

  • 热门应用
  • 热门游戏
  • 热门专题
LightTPD 1.4.54
类型:服务器区 大小:5.61 MB 版本: 时间:07-25
立即下载

相关下载

'); })();