How to Setup DokuWiki with TurnKey Linux

Open the proxmox manager (DNS should look like https://VirtMan-XX.yourdomainspace.com:8006). Login with a DomainAdmins account.

Install a fresh TurnKey Linux LAMP Stack using one of the available template in proxmox.
See How to Setup a TurnKey Linux Container

Now that you have a LAMP Stack running, you will need to connect to it using the 'root' account.

ssh root@wiki.yourdomainspace.com

Once connected, you will be ask to create the mysql 'root' password. We are now able to download the DokuWiki locally using:

wget https://wiki.laswitchtech.com/downloads/dokuwiki.tgz

I have taken the liberty of reuploading this file on this site because on DokuWiki's site you always get a different download link which can only be used once. Now that the DokuWiki has been downloaded, we can now extract the content using:

tar -xvzf dokuwiki.tgz

Alright now we have to clean the apache directory so that only DokuWiki will be displayed. You can do this by running:

rm -vfr /var/www/*

Now we can copy the DokuWiki site we have extracted earlier using :

cp -vR dokuwiki/* /var/www/

Before we run the configuration page, we need to set the appropriate permission on the site by using:

chown -vR www-data:www-data /var/www/

Now the last thing to do is to run the configuration page. Open your browser and follow this link (Change accordingly).
http://service.yourdomainspace.com/install.php

Once you have configure your DokuWiki instance, I recommend you delete the install.php file to prevent someone else from overwriting your wiki.

Now that the wiki is online, we want to secure the site against unauthorized access. There is a few ways to appropriately secure the wiki. But the most reliable way is by configuring the apache server. For that we need to modify the configuration file.

nano /etc/apache2/sites-available/000-default.conf

We will need to add these configuration inside both virtual host.

<LocationMatch "/(data|conf|bin|inc)/">
  Order allow,deny
  Deny from all
  Satisfy All
</LocationMatch>

I recommend you enforce SSL encryption on the site. You can do this by adding a redirect directive to the VirtualHost *:80.

Redirect / https://wiki.yourdomainspace.com/

Once you are done editing the config file. We need to restart the apache service to apply the changes.

service apache2 restart

Example of configuration file

You can use Let's Encrypt to provide the SSL Certificate for your NextCloud installation. TurnKey Linux already provides a simple interface to make those changes to you Stack. You can enter :

confconsole

From there, you can go into the <Advanced Menu> and select “Let's encrypt”.

Once there, we first need to generate a certificate by selecting “Get certificate”. You will get a tips explaining that to create the certificate, a valid DNS record must exist on the web. If this is not the case, make sure you configure one. If this site is only displayed in the internal network, just configure a dummy web server and create a DNS record that points to it online. This will allow CertBot to find something in order to confirm that the certificate you are requesting points to a site that exist. Now you can enter all the valid DNS Record that points to the NextCloud site.

Now that you have your certificate, you should enable the automatic renewal of the certificate.

Let's Encrypt is now configured.