Configuring DokuWiki and pretty URLs with Caddy

There is no documentation on this, so I'm going to make it known.

Add this to your Caddyfile and restart Caddy. You will need to adjust the host name and potentially the socket or IP address for FPM.

Afterwards, you can enable .htaccess-style pretty URLs in DokuWiki.

doku.example.com {  
    fastcgi / /run/php/php7.0-fpm.sock php
    root /var/www/doku.example.com
    internal /data
    internal /conf
    internal /bin
    internal /inc

    rewrite /_media {
        r (.*)
        to /lib/exe/fetch.php?media={1}
    }

    rewrite {
        to {path} {path}/ /doku.php?id={path_escaped}&{query}
    }
}