Setting up this Wiki

Intro

I'm self-hosted, and I want to run a wiki (this) behind a proxy. My front-end is NGINX while the page you are reading is Apache.

From 30,000 feet.

Prerequisites

Steps

  <VirtualHost *:xxxx>
    ServerAdmin webmaster@localhost
    ServerName  wiki.mikelivolsi.com

    DocumentRoot /var/www/wiki/dokuwiki

    DirectoryIndex doku.php index.php


    <Directory /var/www/wiki/dokuwiki/>
        Options Indexes FollowSymLinks MultiViews
        Require all granted
        AllowOverride All
        DirectoryIndex doku.php index.php
    </Directory>

    <IfModule mod_dav.c>
        Dav off
    </IfModule>

    ScriptAlias /cgi-bin/ /var/www/wiki/cgi-bin/

    <Directory "/var/www/wiki/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Require all granted

        AddHandler cgi-script .cgi .pl .py
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
    CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined
</VirtualHost>
$conf['baseurl'] = '/';
$conf['basedir'] = '/wiki';
$conf['useurlrewriting'] = false;  // keep false for reverse proxy
            http://<your ip>/install.php
    # Static assets for WordPress
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
 

My block

    # -------------------------------
    # DokuWiki reverse proxy
    # -------------------------------
    location ^~ /wiki/ {
        proxy_pass http://192.168.1.x:xxxx/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Important for DokuWiki
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;

        proxy_redirect off;
    }

    # Redirect /wiki (no trailing slash)
    location = /wiki {
        return 301 /wiki/;
    }

Afterwards, if you go to your site.. like “https://www.mikelivolsi.com/wiki” it will take you to your wiki.

Notes

 Certificates are handled by the front-end server, so the back-end can run http