From 7a70f8af7644ee7fc02bf7bfca08dd896defa8a1 Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Sat, 14 Mar 2020 09:08:38 +0100 Subject: [PATCH] Testing (#55) * Remove unused code * Add rewrite URL functionnality * Fix subpath handling * Fix nginx error nginx: [emerg] named location "@dokuwiki" can be on the server level only in /etc/nginx/conf.d/sub.example.org.d/dokuwiki.conf:20 * [enh] Enforce URL rewrite * Increment package version Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> --- conf/local.protected.php | 7 ++++--- conf/nginx.conf | 18 +++++++++++++++++- manifest.json | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/conf/local.protected.php b/conf/local.protected.php index f1b27c4..0604e4e 100644 --- a/conf/local.protected.php +++ b/conf/local.protected.php @@ -23,11 +23,12 @@ $conf['plugin']['authldap']['port'] = 389; $conf['plugin']['authldap']['version'] = 3; $conf['plugin']['authldap']['usertree'] = 'ou=users,dc=yunohost,dc=org'; $conf['plugin']['authldap']['userfilter'] = '(&(uid=%{user})(objectClass=posixAccount))'; -# no groups -#$conf['plugin']['authldap']['grouptree'] = 'ou=Group, dc=server, dc=tld'; -#$conf['plugin']['authldap']['groupfilter'] = '(&(objectClass=posixGroup)(|(gidNumber=%{gid})(memberUID=%{user})))'; /* Advanced Settings */ $conf['updatecheck'] = 0; //automatically check for new releases? + // Taken from previous package. Don't know what it does. Maybe Yunohost corner logo ? $conf['cssdatauri'] = 512; //Maximum byte size of small images to embed into CSS, won't work on IE<8 + +// URL Rewriting is handled by the webserver +$conf['userewrite'] = 1; // See https://www.dokuwiki.org/config:userewrite diff --git a/conf/nginx.conf b/conf/nginx.conf index c17758d..67b1f32 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,8 @@ +# config built from these sources: +# https://www.dokuwiki.org/install:nginx +# https://www.nginx.com/resources/wiki/start/topics/recipes/dokuwiki/ +# https://forum.dokuwiki.org/thread/17126 + #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { @@ -14,7 +19,8 @@ location __PATH__/ { # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file client_max_body_size 25M; - try_files $uri $uri/ index.php; + try_files $uri $uri/ @dokuwiki; + location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; @@ -45,3 +51,13 @@ location __PATH__/ { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +# rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki confi$ +location @dokuwiki { + rewrite ^__PATH__/_media/(.*) __PATH__/lib/exe/fetch.php?media=$1 last; + rewrite ^__PATH__/_detail/(.*) __PATH__/lib/exe/detail.php?media=$1 last; + rewrite ^__PATH__/_export/([^/]+)/(.*) __PATH__/doku.php?do=export_$1&id=$2 last; + # Specifig to "tag plugin". Added here to allow plugin to work if installed + rewrite ^__PATH__/tag/(.*) __PATH__/doku.php?id=tag:$1&do=showtag&tag=tag:$1 last; + rewrite ^__PATH__/(.*) __PATH__/doku.php?id=$1&$args last; +} diff --git a/manifest.json b/manifest.json index 8f68fac..1c3ae56 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ "es": "DokuWiki es un sistema de Wiki de uso sencillicimo y compatible con los estándares.", "it": "DokuWiki è un Wiki aderente agli standard, semplice da usare, finalizzato principalmente alla creazione di documentazione di qualsiasi tipo." }, - "version": "2018-04-22a~ynh2", + "version": "2018-04-22a~ynh3", "url": "https://www.dokuwiki.org", "license": "GPL-2.0-or-later", "maintainer": {