Monday, December 1, 2008

Multiple applications on localhost with lighttpd

I've been playing with Wiki applications for sometime. Well, to be honest, instead of "playing", "struggling" is much more suitable.

I've searched for hosting multiple applications by separating paths like $HOST/moinmoin/, $HOST/twiki/ etc.. But couldn't find useful tips around (or i'm not that good at Searching The Fine Web). Being tired of switching lighttpd configurations for each wiki setup, i've dived into configuration file and managed to make it run multiple wikis(one cgi, one fcgi) separated by pathnames.

Anyway, below is the snippet from my local server's lighttpd.conf. Somewhat messy, but works good for a few minutes work. http://localhost/twiki/ and http://localhost/moin/ redirects requests to said wiki engines.


$HTTP["host"] == "localhost" {
url.rewrite-once = (
"^/robots.txt" => "/robots.txt",
"^/favicon.ico" => "/favicon.ico",
"^/moin/moin_static173/(.*)" => "/moin/moin_static173/$1",
"^/moin/(.*)" => "/moin/wiki-engine/$1",
#"^/bin/?(.*)$" => "/twiki/bin/$1",
#"^/pub/?(.*)$" => "/twiki/pub/$1",
"^/twiki/(bin|pub)/(.*)$" => "/twiki/$1/$2",
"^/twiki/(.*)$" => "/twiki/bin/view/$1"
)
alias.url = (
"/moin_static173/" => "/usr/share/moin/htdocs/",
"/twiki/bin" => "/home/den/public_html/bin",
"/twiki/pub" => "/home/den/public_html/pub",

)
$HTTP["url"] =~ "^/moin/wiki-engine/" {
server.document-root = "/home/den/calisma/python/moin/"
fastcgi.server = ( "/moin/wiki-engine" =>
(( "docroot" => "/",
"min-procs" => 1,
"max-procs" => 2,
"max-load-per-proc" => 2,
"bin-path" =>
"/home/den/calisma/python/moin/bin/moin.fcg",
"host" => "127.0.0.1",
"port" => 3060,
"check-local" => "disable",
"broken-scriptfilename" => "enable",
))
)
}



$HTTP["url"] =~ "^/twiki/bin" {
cgi.assign = (
"" => "" ,
".pl" => "/usr/local/bin/perl",
".cgi" => "/usr/local/bin/perl",
".py" => "/usr/bin/python"
)

server.document-root = "/home/den/public_html/"
server.indexfiles = ("index.html", "index.pl",
"index.cgi")
}
}

0 comments: