How to Migrate DokuWiki on 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

One of the nicest thing about DokuWiki is the fact that it does not rely on any SQL Database. Thus to migrate a DokuWiki installation, you simply need to copy the entire public directory to the new server. But first we need to empty the destination server public directory.

rm -vfr /var/www/*

In our case, we will use SSH to transfer the source DokuWiki server to the destination DokuWiki server.

scp -r root@wiki-01.yourdomainspace.com:/var/www/ root@wiki-02.yourdomainspace.com:/var/

Once the transfer is completed, we need to set the appropriate permission on the site by using:

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

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.