Table of Contents
Apache
Apache is the most widely used webserver with DokuWiki. Most hosting providers offering PHP hosting will also use Apache.
Installation
Basically all Linux distributions offer an Apache package for easy installation. Please refer to your distribution's documentation on how to install software packages.
Windows user can pick installation packages from various third party vendors. A good alternative is also our DokuWiki on a Stick.
MacOS?
Adding PHP support
PHP can be added through mod_php or fpm.
add info
Enabling .htaccess Support
Rewriting for nicer URLs
To enable URL rewriting you first need to enable the mod_rewrite module. On most Linux distributions this can be done by calling:
sudo a2enmod rewrite sudo apache2ctl restart
Rewrite rules can then be configured on a per vhost base or via a .htaccess
file. The latter is the more common use - see above on how to enable .htaccess
files.
Dokuwiki comes with a distribution copy of the .htaccess-file called .htaccess.dist
, simply rename the file to .htaccess
and edit it to uncomment the appropriate lines.
Here is an example how the rewrite rules should look like.
RewriteEngine on RewriteBase /dokuwiki RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L,B] RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L,B] RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L,B] RewriteRule ^$ doku.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) doku.php?id=$1 [QSA,L,B] RewriteRule ^index.php$ doku.php
Please note that the line RewriteBase /dokuwiki
may not be needed at all. If you use it, you need to replace the /dokuwiki
path with whatever directory you use in your URL to get to the wiki. If your wiki appears at the top level of the domain (e.g. http://example.com points to the start page of the wiki) then use RewriteBase /
.
B flag is required from apache 2.4.56 in order to avoid error AH10411: Rewritten query string contains control characters or spaces
Apachectl status broken
Dokuwiki rewrite rules can affect the apachectl status command and make it return a DokuWiki 404 page instead of the server-status page. You can fix that by either adding an exception to the rewrite rules
RewriteCond %{REQUEST_URI} !^/server-status$
or creating an empty server-status file in dokuwiki root folder where doku.php is located.
See forum post Apachectl status is broken with dokuwiki