標籤:style http io color ar os 使用 java sp
一.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指令碼後會自己主動退出,所以自己寫一個維護程式或者去找一個第三方的監視管理程式。
windows下使用lighttpd+php(fastcgi)+mysql