User Tools

Site Tools


install_dokuwiki

This is an old revision of the document!


Install DokuWiki

A FreeBSD 11.2-RELEASE was installed on a PCEngines box to host a DokuWiki server.

Install and configure DokuWiki

Install DokuWiki and Apache.

sudo pkg install dokuwiki
sudo pkg install apache24

Edit the config file of system environment (for booting next time) for Apache (2.4): add in /etc/rc.conf

apache24_enable="YES"

comment out/edit /usr/local/etc/apache24/httpd.conf

#DocumentRoot "/usr/local/www/apache24/data"
DocumentRoot "/usr/local/www/dokuwiki"

<Directory "/usr/local/www/dokuwiki">
	Options Indexes FollowSymLinks
	DirectoryIndex index.php
	AllowOverride None
	Require all granted
</Directory>

Install PHP module

sudo pkg install mod_php71

check if the LoadModule line was added

cat /usr/local/etc/apache24/httpd.conf | grep php

should output

LoadModule php7_module        libexec/apache24/libphp7.so

add in /usr/local/etc/apache24/httpd.conf

<IfModule php7_module>
        DirectoryIndex index.php index.html
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
</IfModule>

change the owner of conf and data in /usr/local/www/dokuwiki/ to the web server.

sudo chown -R www:www /usr/local/www/dokuwiki/conf
sudo chown -R www:www /usr/local/www/dokuwiki/data

restart FreeBSD

For a initial config, open wiki install.php in browser

http://192.168.178.65/install.php

enter data, for example

Wiki Name: nplab
Superuser: admin
E-Mail: timo.voelker@fh-muenster.de
Initial ACL policy: Closed Wiki
license: CC Attribution-Share Alike 4.0 International

after that /usr/local/www/dokuwiki/conf/local.php contains the configuration

It is recommended to separate config and binaries from DokuWiki website files. Create a directory outside of the installation path

sudo mkdir -p /var/dokuwiki/www

move data and conf into /var/dokuwiki/www. Move bin directory into /var/dokuwiki

sudo mv /usr/local/www/dokuwiki/data /var/dokuwiki/www/
sudo mv /usr/local/www/dokuwiki/conf /var/dokuwiki/www/
sudo mv /usr/local/www/dokuwiki/bin /var/dokuwiki/

It is important that the www user (the user that runs apache) has access to these files –> set owner of /var/dokuwiki/www to www

sudo chown -R www:www /var/dokuwiki/www

DokuWiki needs to know where to find these files. Create inc/preload.php

sudo vi /usr/local/www/dokuwiki/inc/preload.php

and add

<?php
// DO NOT use a closing php tag. This causes a problem with the feeds,
// among other things. For more information on this issue, please see:w
// http://www.dokuwiki.org/devel:coding_style#php_closing_tags 
define('DOKU_CONF','/var/dokuwiki/www/conf/');

add in /var/dokuwiki/www/conf/local.php

$conf['savedir'] = '/var/dokuwiki/www/data';

Use https

The server needs a certificate to provide https access. If a certificate in a .p12 file format exist, convert it into a .pem file.

openssl pkcs12 -in certificate.p12 -out certificate.pem -nodes

Copy the .pem file in a .crt and .key file

cp certificate.pem certificate.crt
cp certificate.pem certificate.key

The .crt file should contain the public certificate only. Edit the file and remove everything except the following Block.

-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

The .key file should contain the private key only. Edit the file and remove everything except the following Block.

-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----

Copy both files to /usr/local/etc/apache24/ssl/

mkdir /usr/local/etc/apache24/ssl
cp certificate.crt /usr/local/etc/apache24/ssl/
cp certificate.key /usr/local/etc/apache24/ssl/

Configure apache for SSL access. In /usr/local/etc/apache24/httpd.conf

Uncomment the line

LoadModule ssl_module libexec/apache24/mod_ssl.so

Add

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

and add

ServerName nplab.fh-muenster.de:443
SSLEngine on
SSLCertificateFile "/usr/local/etc/apache24/ssl/certificate.crt"
SSLCertificateKeyFile "/usr/local/etc/apache24/ssl/certificate.key"

To apply these changes, restart Apache serivce

sudo service apache24 restart

On error, check /var/log/httpd-error.log for log messages.

Backup

Backup tar czf dokuwiki_`date +“%Y%m%d”`.tar.gz –exclude data/cache –exclude data/index –exclude data/locks –exclude data/tmp /var/dokuwiki/www save on Apple Time Capsule? Notification on error?

install_dokuwiki.1548844547.txt.gz · Last modified: by msvoelker