Place MediaWiki inside a Virtual Host

From SaruWiki
Revision as of 12:36, 31 January 2009 by Saruman! (talk | contribs) (Problem documented (solution not yet))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The problem

The Debian installation of MediaWiki is quite simple, and immediately after installation you can visit http://www.example.com/wiki, and find your new wiki ready for you. However, if you start using VirtualHosts, and create a second site www.alsoexample.com, then a visit to http://www.alsoexample.com/wiki will reveal the same wiki instance. In fact, whatever virtual host you deploy, on the URI path /wiki you'll always find your single wiki instance deployed.

This might be what you want, but usually it is not. Reason for that would of course be that you customize your wiki to show your www.example.com address in the title bar, or that all subject matter is about "example", and not about "alsoexample".

The cause

So the URI /wiki is pointing to your wiki for every VirtualHost you deploy. The reason that your wiki is behaving like this, is that the Debian installation has created a symlink /etc/apache2/conf.d/mediawiki that's pointing to /etc/mediawiki/apache.conf. The contents of the conf.d directory are included in the Apache configuration, so the MediaWiki configuation is nicely read and understood. However, the apache.conf configuration file is not VirtualHost compatible; it just aliases the web folder /wiki to the /var/lib/mediawiki directory, without regards for the virtual host name that's called upon. In fact, the first few lines of apache.conf admit as much:

# Uncomment this to add an alias.
# This does not work properly with virtual hosts..
Alias /wiki /var/lib/mediawiki

The solution