A site's apache configuration is automatically generated in
/etc/apache2/sites-available/ikisite-*
.
It can be useful to tweak apache settings for a single site. To allow this,
use /etc/ikiwiki-hosting/config/$username/apache.conf.tmpl
This is an apache2 config fragment, that, if present, is inserted into the
site's generated apache config file by ikisite enable
. Remeber to run
ikisite enable
if modifying it.
It is inserted inside the <VirtualHost>
tag in the apache config file,
at the end. So it can override anything that comes before, add additional
settings, etc. It is actually a HTML::Template template, and can contain
the same variables as apache-site.tmpl
. (HOSTNAME, HOME, etc.)
Example:
<Directory <TMPL_VAR HOME>/public_html>
Options +Foo
AuthName "<TMPL_VAR HOSTNAME>"
AuthType Basic
AuthUserFile <TMPL_VAR HOME>/apache/htpasswd
Require valid-user
</Directory>
Note the use of "+" to add to the default Options, rather than overriding it.
Crazy example to add another, custom vhost:
</VirtualHost>
<VirtualHost>
...
</VirtualHost>
Note that the advantage of using this, over just allowing a htaccess file, is that the site's owner could modify a htaccess file, but can't modify this file. This avoids needing to worry about security issues with htaccess files. (Also, apache's documentation warns about performance implications of enabling htaccess files.) Of course, if a htaccess file is really wanted for a given site, this file can be used to enable it.