Revision [15058]

This is an old revision of LighttpdConfig made by BulletCard on 2006-08-03 17:14:55.

 

Configuring Lighttpd for Wikka


Introduction

I recently got Wikka running under lighttpd, and since I was only able to find limited documentation to support that effort either here or elsewhere, I thought I should document my experience for posterity.

Before I get started, though, I need to acknowledge JavaWoman and LadySerena from WikkaOnIrc #wikka, both for their assistance in getting the URL rewriting working, and for encouraging me to record the results.

Server Configuration

For my particular installation, I wanted to serve Wiki content out of the document root for a dedicated subdomain. So rather than have my Wiki reside at, say, http://www.example.com/wiki, I wanted it at http://wiki.example.com/. I also wanted it to use user-friendly URLs, like http://wiki.example.com/HomePage, rather than the out-of-the-box query-string URLs, such as http://wiki.example.com/wikka.php?wakka=HomePage. Finally, to get the best performance out of the combination of lighttpd and PHP, I chose to interface them using FastCGI.

To that end, I unpacked the Wikka distribution into the directory I had selected for my subdomain's document root, and then set about editing my lighttpd.conf configuration file.

Lighttpd Configuration

With respect to the server.modules configuration parameter, you will need to include mod_fastcgi for FastCGI support and, if you want user-friendly URLs, mod_rewrite. You should also make sure the index.php is included among the values for the server.indexfiles configuration parameter.



$HTTP["host"] =~ "wiki\.example\.com" {
  server.document-root = "/full/path/to/wiki/root/"
  fastcgi.server = ( ".php" =>
			( "localhost" =>
			  ( "socket" => "/tmp/wikkawiki.socket",
				"max-procs" => 2,
				"bin-path" => "/full/path/to/php-cgi",
				"bin-environment" =>
				( "PHP_FCGI_CHILDREN" => "2",
				  "PHP_FCGI_MAX_REQUESTS" => "5000"
				)
			  )
			)
		   )
  url.rewrite-once = (
			"^(/images/.*)$" => "$1",
			"^(/css/.*)$" => "$1",
			"^(/3rdparty/plugins/freemind/.*)$" => "$1",
			"^(/3rdparty/plugins/wikiedit/.*)$" => "$1",
			"^(.*)$" => "wikka.php?wakka=$1"
		   )
}


References


The Gentoo Linux Wiki has a good overview of configuring Lighttpd for PHP applications. Some of the material, such as installation utilities and paths, is specific to Gentoo, but adapting this information to other Unix-based operating systems should be pretty straightforward.

With respect to URL rewriting, the information on this Wiki regarding configuration of Apache's ModRewrite mod_rewrite module for Wikka was a good reference for understanding the requirements that I needed to match in lighttpd.

There is one comment on this page. [Display comment]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki