When my infrastructure grew to a certain level of complexity, I realised I was having to remember a lot to keep it all together. For some time I’d been (and still am) a big fan of Zim Desktop Wiki however this is less than practical for using multiple machines and doesn’t work at all if you’re connecting over a remote connection, really I needed something web based.
MediaWiki is a popular choice, as is tiddlyWiki but both have a steep learning curve and were too overblown for what I needed. A search on WikiMatrix led me to some false starts but eventually led me to an unknown application called BananaDance that was ideal.
Operating System: Ubuntu 16.04
Required Applications: php5, php5-fpm, nginx, openssl, build-essentials, git, curl
Install the Pre-Requisite Software
sudo apt-get update sudo apt-get install php5 php5-fpm nginx openssl composer build-essentials git curl php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === 'SHA_384_Sig_Key') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;" php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
Create an encrypted hash table for security
This will be used to provide a username/password prompt for the web server login:
sh -c "echo -n 'welsh:' >> /etc/nginx/.htpasswd" sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
Enter a password when prompted and then verify that it’s hash has been saved with:
cat /etc/nginx/.htpasswd
Configure the webserver
Edit the NGINX default website
Ahead of this I have generated a certificate and private key from the CA built earlier, this will be used to help secure the webserver with https.
sudo nano /etc/nginx/sites-enabled/default
Remove any content and enter the following configuration:
server { listen 443 default_server ssl; ssl_certificate /etc/ssl/certs/wiki.crt ssl_certificate_key /etc/ssl/private/wiki.key server_name wiki.tinfoilcipher.co.uk; #replace with your own server name root /var/www/html; index.php server_name wiki.tinfoilcipher.co.uk; root /var/www/html; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri $uri/ =404; auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; } }
Save the config with CTRL+O and restart the web server:
sudo /etc/init.d/nginx restart
Deploy BananaDance
NGINX is now deployed, however it does not contain any content, we need to install BananaDance next:
cd ~ composer create-project jbelelieu/banana_dance_lite --prefer-dist cd ~/banana_dance_lite mv -R * /var/www/html rm /var/www/html/index.nginx-debian.html chmod -R 755 /var/www/html
BananaDance is now deployed and it’s content exists within /var/www/html/wiki/en. Files can be created and written in markdown.
The server should be accessible at https://your_hostname and you will be prompted for the username/password set up in the hash table.