Manual:Installing MediaWiki with Lighttpd

This page presents step-by-step instructions for installing MediaWiki with Lighttpd and PHP+FastCGI. We will assume you have MySQL installed already.

  • Download Lighttpd
  • Download PHP (Archived 1998-07-01 at the Wayback Machine)
  • gzip -dc lighttpd-1.3.14.tar.gz | tar xf -
  • cd lighttpd-1.3.14
  • ./configure --prefix=/opt/lighttpd
  • make all install
  • cp doc/lighttpd.conf /etc/
  • cd ..
  • gzip -dc php-5.0.4.tar.gz | tar xf -
  • cd php-5.0.4
  • ./configure --enable-fastcgi --with-mysql=<path to MySQL installation> --prefix=/opt/php-fcgi
  • make all install
  • Edit /etc/lighttpd.conf as appropriate. You will need to add at least the following lines:
fastcgi.server = ( ".php" =>
                   ( "localhost" =>
                     (
                       "host" => "127.0.0.1",
                       "port" => 1026,
                       "bin-path" => "/opt/php-fcgi/bin/php-cgi"
                     )
                   )
                )

url.rewrite-once = (
                     "^/wiki/upload/(.+)" => "/wiki/upload/$1",
                     "^/$" => "/w/index.php",
                     "^/wiki/([^?]*)(?:\?(.*))?" => "/w/index.php?title=$1&$2"
                   )

If you use the static-file module, it will try to cache everything it can... including the PHP modules that are supposed to be executed instead. So in many cases you'll also need to add:

  static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

or at least:

  static-file.exclude-extensions = ( ".php" )

And if you also want to support "http://yoursite/ArticleName" URLs:

url.redirect = ( "^/(?!w|wiki|robots\.txt|favicon\.ico)(.*)" => "/wiki/$1" )

Ensure the "rewrite", "redirect" and "fastcgi" modules are enabled.

  • Extract the MediaWiki source into your document root, and mv mediawiki-1.5beta1 w
  • Start lighttpd: /opt/lighttpd/sbin/lighttpd -f /etc/lighttpd.conf
  • Visit "http://www.yoursite.com/w/config/index.php" and configure MediaWiki as documented at Manual:Installation guide
  • Edit LocalSettings.php and change $wgArticlePath to:
$wgArticlePath = "/wiki/$1";
  • Done
  • Not Done! Test

See also edit