How to Enable Wiki Services on Multiple Virtual Hosts with Mountain Lion Server
If you’d like to activate the wiki service on domains other than your server’s default site, there doesn’t seem to be any built-in way to do it. However, by leveraging the web app framework baked into OS X Server, you can easily set it up so the wiki service can be turned on or off for a given domain with the flick of a switch.
Turning on the wiki service for OS X Server is straightforward, with almost nothing to configure. But there’s something missing here… It’s all so easy, but especially if you follow the philosophy of using the server’s own domain for as little as possible and running all your sites from virtual hosts (“Basic Configuration and Preparing the Way for Extra Software OS X Server Needs”), how exactly do you use it on other virtual hosts and not just on the main site?
Each time you set up a new virtual host in Server.app, you’re given the opportunity to set which indexes will be available for that site — index.html
, index.php
, default.html
, and /wiki/
. You could be forgiven for thinking that if you include /wiki/
in the list, and perhaps even put it at the top of the list (since the list will be checked in order), then you’ll be able to visit http://example.com/wiki/
and find a working wiki. Unfortunately, apart from the default site, that’s not how it works. Try as you might, you will not get a working wiki for any of your vhosts without special steps.
There are several suggestions floating around the web to make use of rewrite rules in .htaccess
to enable visitors to access wikis via other domains besides the main one, but in my view these involve too many weaknesses and compromises to consider. The ‘right’ way to do this, as far as I am concerned, is to leverage the web app framework which Apple already provides to bring the wiki service as a web app to any virtual host which requires it. As far as I’m aware, this is actually the only way to provide full wiki functionality and consistent URL structures for wikis on other than the default host. There is, of course, still only one underlying wiki service, so enabling it on different virtual hosts still means enabling all of it on different virtual hosts. Naturally, access to each individual wiki can be controlled with the usual methods, but what we can’t do is to provide a different and separate wiki service on each virtual host.
To see how Apple provides the wiki service for the default host, take a look at the following .conf
files in .../apache2/
and their associated .plist
files from .../apache2/webapps/
:
httpd_webdavsharing.conf
httpd_corecollaboration_required.conf
httpd_corecollaboration_webauth.conf
httpd_corecollaboration_shared.conf
The web apps themselves which are required to support the wiki service are these:
com.apple.webapp.webdavsharing
com.apple.webapp.auth
com.apple.webapp.collab
com.apple.webapp.collabd.settings
com.apple.webapp.postgres
Why these specific files? If you enable the wiki service for the default site and watch what happens to that site’s configuration file, you can see which switches need to be thrown in order to bring the wiki service to that site.
Now what we could do, if we wanted, would be simply to copy all the lines which get added to the default sites’ configuration files when the wiki service is enabled and add them to any virtual host where we’d also like to use the wiki service. That does work, but it’s brittle and fiddly. Instead, we can just take a quick run through the .plist
files which activate these .conf
files and copy everything we need out of those into a new .plist
that can be used to switch the wiki service on or off with a single checkbox back in Server.app.
To save you the trouble, here’s what comes out if you do that, with the end result named, in this example case, net.mulhauser.webapp.wikienabler
:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>name</key> <string>net.mulhauser.webapp.wikienabler</string> <key>displayName</key> <string>Wiki enabler</string> <key>includeFiles</key> <array> <string>/Library/Server/Web/Config/apache2/httpd_webdavsharing.conf</string> <string>/Library/Server/Web/Config/apache2/httpd_corecollaboration_required.conf</string> <string>/Library/Server/Web/Config/apache2/httpd_corecollaboration_webauth.conf</string> <string>/Library/Server/Web/Config/apache2/httpd_corecollaboration_shared.conf</string> </array> <key>launchKeys</key> <array/> <key>proxies</key> <dict> <key>/collabdproxy</key> <dict> <key>path</key> <string>/collabdproxy</string> <key>urls</key> <array> <string>http://localhost:4444/svc</string> </array> </dict> <key>/__wiki/preview</key> <dict> <key>path</key> <string>/__wiki/preview</string> <key>urls</key> <array> <string>http://localhost:4444/preview</string> </array> </dict> <key>/wiki</key> <dict> <key>path</key> <string>/wiki</string> <key>urls</key> <array> <string>http://localhost:8090/wiki</string> <string>http://localhost:8091/wiki</string> <string>http://localhost:8092/wiki</string> <string>http://localhost:8093/wiki</string> <!-- <string>http://localhost:8094/wiki</string> <string>http://localhost:8095/wiki</string> <string>http://localhost:8096/wiki</string> <string>http://localhost:8097/wiki</string> --> </array> </dict> <key>/wiki/files/download</key> <dict> <key>path</key> <string>/wiki/files/download</string> <key>urls</key> <array> <string>http://localhost:4444/files</string> </array> </dict> <key>/groups</key> <dict> <key>path</key> <string>/groups</string> <key>urls</key> <array> <string>http://localhost:8090/groups</string> <string>http://localhost:8091/groups</string> <string>http://localhost:8092/groups</string> <string>http://localhost:8093/groups</string> <!-- <string>http://localhost:8094/groups</string> <string>http://localhost:8095/groups</string> <string>http://localhost:8096/groups</string> <string>http://localhost:8097/groups</string> --> </array> </dict> <key>/users</key> <dict> <key>path</key> <string>/users</string> <key>urls</key> <array> <string>http://localhost:8090/users</string> <string>http://localhost:8091/users</string> <string>http://localhost:8092/users</string> <string>http://localhost:8093/users</string> <!-- <string>http://localhost:8094/users</string> <string>http://localhost:8095/users</string> <string>http://localhost:8096/users</string> <string>http://localhost:8097/users</string> --> </array> </dict> <key>/search</key> <dict> <key>path</key> <string>/search</string> <key>urls</key> <array> <string>http://localhost:8090/search</string> <string>http://localhost:8091/search</string> <string>http://localhost:8092/search</string> <string>http://localhost:8093/search</string> <!-- <string>http://localhost:8094/search</string> <string>http://localhost:8095/search</string> <string>http://localhost:8096/search</string> <string>http://localhost:8097/search</string> --> </array> </dict> <key>/wiki/ipad</key> <dict> <key>path</key> <string>/wiki/ipad</string> <key>urls</key> <array /> </dict> <key>/wiki/images</key> <dict> <key>path</key> <string>/wiki/images</string> <key>urls</key> <array /> </dict> <key>/wiki/javascripts</key> <dict> <key>path</key> <string>/wiki/javascripts</string> <key>urls</key> <array /> </dict> <key>/wiki/static</key> <dict> <key>path</key> <string>/wiki/static</string> <key>urls</key> <array /> </dict> <key>/wiki/testtool</key> <dict> <key>path</key> <string>/wiki/testtool</string> <key>urls</key> <array /> </dict> <key>/wiki/stylesheets</key> <dict> <key>path</key> <string>/wiki/stylesheets</string> <key>urls</key> <array /> </dict> <key>/wiki/locales</key> <dict> <key>path</key> <string>/wiki/locales</string> <key>urls</key> <array /> </dict> <key>/auth</key> <dict> <key>path</key> <string>/auth</string> <key>urls</key> <array> <string>http://localhost:8086/auth</string> </array> </dict> <key>/auth/images</key> <dict> <key>path</key> <string>/auth/images</string> <key>urls</key> <array /> </dict> <key>/auth/javascripts</key> <dict> <key>path</key> <string>/auth/javascripts</string> <key>urls</key> <array /> </dict> <key>/auth/stylesheets</key> <dict> <key>path</key> <string>/auth/stylesheets</string> <key>urls</key> <array /> </dict> </dict> <key>requiredModuleNames</key> <array> <string>proxy_module</string> <string>xsendfile_module</string> <string>headers_module</string> <string>expires_module</string> <string>deflate_module</string> <string>rewrite_module</string> <string>bonjour_module</string> </array> <key>requiredWebAppNames</key> <array> <string>com.apple.webapp.webdavsharing</string> <string>com.apple.webapp.auth</string> <string>com.apple.webapp.collab</string> <string>com.apple.webapp.collabd.settings</string> <string>com.apple.webapp.postgres</string> </array> <key>installationIndicatorFilePath</key> <string>/Library/Server/Web/Config/apache2/extra/httpd_grm_wikienabler.conf</string> <key>sslPolicy</key> <integer>0</integer> </dict> </plist>
Of course this can be cleaned up — for example, by removing the commented out lines — but I have deliberately copied the relevant configurations from Apple’s own .plist
files exactly, to make it easier to identify in the future when something has been changed by a software update. I assume that at some point, Apple is going to change the wiki service, and therefore our web app which is piggy-backing on that service will need to change too. Expect to have to rebuild this file after future updates if you plan to use this method for hosting wikis on multiple virtual hosts. (If we’re lucky, maybe Apple will change it by explicitly providing a way to enable the wiki service on more than one domain, so we don’t have to do this ourselves!)
In any case, if you place this .plist
in .../apache2/webapps/
and pair it with a (for now) blank file, which in this example case I have named httpd_grm_wikienabler.conf
, in .../apache2/extra/
(which you can create if it isn’t present already), you then wind up with a fully-functioning wiki service which can be enabled on any individual virtual host.
You can now enable the wiki service itself — which as of this writing will only make it available on the default host — and then enable it on other virtual hosts using the web app. (Important: don’t do both at once for the default site, as it will result in extra directives being placed in the .conf
file.) Note that the ProxyPass
directives for /wiki/
that get placed in your default site’s .conf
file will mean that any .htaccess
digest authentication protection you have in place will be bypassed. This can be remedied by setting digest authentication with a web app instead, as I’ve described separately in the article on password protecting directories or files on OS X Server. (See “Password Protecting Directories, Files or Whole Domains via a Web App”.)
Note that if Apple changes this odd setup in the future — so that enabling the wiki service makes it available for all hosts — you may be able to further tighten things down by removing /wiki/
from the list of permitted index types for a given host. In other words, even if the wiki service is otherwise enabled for any given host, you can prevent access to it by removing /wiki/
from the list.
All material on this site is carefully reviewed, but its accuracy cannot be guaranteed, and some suggestions offered here might just be silly ideas. For best results, please do your own checking and verifying. This specific article was last reviewed or updated by Greg on .