Dokuwiki uses relative pathnames wherever I looked, so it
should be fine. But I don't know nginx at all, so I might be very wrong... but I'd assume you'd have to change the
root /dokuwiki
to
root /
, throw out the @dokuwiki out of try_files, change
location @dokuwiki {
to
location /dokuwiki {
and adapt the rewrite rules like so:
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
rewrite ^/(.*) /doku.php?id=$1&$args last;
becomes
rewrite ^(/dokuwiki)/_media/(.*) $1/lib/exe/fetch.php?media=$2 last;
rewrite ^(/dokuwiki)/_detail/(.*) $1/lib/exe/detail.php?media=$2 last;
rewrite ^(/dokuwiki)/_export/([^/]+)/(.*) $1/doku.php?do=export_$2&id=$3 last;
rewrite ^(/dokuwiki)/(.*) $1/doku.php?id=$2&$args last;
Probably
try_files $uri $uri/ /doku.php;
could be changed to
try_files $uri $uri/ /dokuwiki/doku.php;
in the ~ \.php location, also. Or better throw out /doku.php there, it shouldn't be needed if there are no nonexistant .php.
Then you could use the rest of the server like usual, and address the dokuwiki with
http://www.example.com/dokuwiki/. Given my background, that's a bit of a wild guess, though...
(I hate it when ppl give me answers like "why do you want to do that" or "use a different webserver", but I believe it's fair after answering the original question, so: I used dokuwiki with lighttpd on a RasPi, and that works like this out of the box afair. Might be an option.)