Skip to content

Virtualhosting MediaWiki on Debian Bullseye (11)

Tools we use: Open source tools we use at BFC Computing. Let us know if you'd like help moving to open source tools!
Tools we use

If you want to use the maintained Debian MediaWiki package, it’s going to be 1.3.5 and it really wants to be in without a virtualhost. You can install a newer MediaWiki (now 1.3.8) from source, but it won’t be maintained. The second problem we can take care of with a simple Apache config.

FWIW, MediaWiki has a page about this, but I couldn’t get any of it to work their way and reading their configs I don’t know if it’s worked in many years. This is more simple anyway.

It is assumed this is your server and you know how to load mod_rewrite and php_fpm and configure certs and everything.

With these assumptions:

  • virtualhost:
  • path: /w
  • documentroot : /var/www/
  • https

Set your LocalSettings.php file to include:

$wgScriptPath = "/w";
$wgServer = "";

and your Apache virtualhost to include:

DocumentRoot /var/www/
Alias /w         /usr/share/mediawiki
Alias /mediawiki /usr/share/mediawiki
RewriteEngine On
RewriteRule ^/*$ /w [R,L]

And that should do it.

The mediawiki alias is to support the “Powered by Debian” icons at the bottom of your sample config file. If you want to get rid of both you may, but don’t just do one.