Dokuwiki is the best Open Source project I have ever used, so I have prepared a simple step-by-step guide to help you get started. It is relatively brief and concise as most of the code was already described in other blog posts found on this website.
Update package index.
$ sudo apt-get update
Install nginx
server.
$ sudo apt-get install nginx
Install uWSGI
package and php
plugin.
$ sudo apt-get install uwsgi uwsgi-plugin-php curl
Install ufw
program to manage the firewall.
$ sudo apt-get install ufw
Configure the firewall to allow TCP
ports 22
and 80
and deny other incoming connections.
$ sudo ufw allow 80/tcp $ sudo ufw allow 22/tcp $ sudo ufw limit 22/tcp $ sudo ufw default deny incoming $ sudo ufw default allow outgoing $ sudo ufw enable
Increase max upload file size
and max post size
.
$ sudo sed -i -e "/upload_max_filesize/ {s/\\(.*\\) = .*/\\1 = 25M/}" /etc/php5/embed/php.ini $ sudo sed -i -e "/post_max_size/ {s/\\(.*\\) = .*/\\1 = 30M/}" /etc/php5/embed/php.ini
Create /srv/dokuwiki
directory to store website and Dokuwiki
source code.
$ sudo mkdir -p /srv/dokuwiki
Download stable release of Dokuwiki
.
$ sudo curl -L -s -o /srv/dokuwiki-stable.tgz http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Extract Dokuwiki
source code.
$ sudo tar --extract --gzip --file /srv/dokuwiki-stable.tgz --strip 1 --directory /srv/dokuwiki
Enable pretty URLs.
$ cat <<EOF | sudo tee /srv/dokuwiki/conf/local.php <?php \$conf['userewrite'] = 1; ?> EOF
Change group and owner to www-data
.
$ sudo chown -R www-data:www-data /srv/dokuwiki
Configure PHP
interpreter application using uWSGI
.
$ cat <<EOF | sudo tee /etc/uwsgi/apps-available/php.ini [uwsgi] plugins = php chown-socket = www-data:www-data processes = 4 EOF
Enable PHP
interpreter.
$ sudo ln -s /etc/uwsgi/apps-available/php.ini /etc/uwsgi/apps-enabled/
Restart uWSGI
application.
$ sudo systemctl restart uwsgi
Disable default nginx
site.
$ sudo unlink /etc/nginx/sites-enabled/default
Configure nginx
site for Dokuwiki
.
$ cat <<EOF | sudo tee /etc/nginx/sites-available/dokuwiki server { listen 80 default_server; server_name dokuwiki.local; client_max_body_size 30M; root /srv/dokuwiki; index doku.php; location / { try_files \$uri \$uri/ @dokuwiki; } location @dokuwiki { rewrite ^/_media/(.*) /lib/exe/fetch.php?media=\$1 last; rewrite ^/_detail/(.*) /lib/exe/detail.php?media=\$1 last; rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_\$1&id=\$2 last; rewrite ^/(?!lib/)(.*) /doku.php?id=\$1&\$args last; } location ~ /(COPYING|README|VERSION|install.php) { deny all; } location ~ /(conf|bin|inc)/ { deny all; } location ~ /data/ { internal; } location ~ \\.php\$ { if (!-f \$request_filename) { return 404; } include uwsgi_params; uwsgi_modifier1 14; uwsgi_pass unix:/run/uwsgi/app/php/socket; } } EOF
Enable configured site.
$ sudo ln -s /etc/nginx/sites-available/dokuwiki /etc/nginx/sites-enabled/
Reload nginx
configuration.
$ systemctl reload nginx
What next?
Perform the following steps to configure Dokuwiki
.
Remove created earlier local.php
file, temporarily allow access to install.php
and use it to configure personal wiki to your liking.
Remember to define rewrite
level to 1
after logging in as administrator
.