From cc49f17eb421d7073ab363775f14b74f640a29ff Mon Sep 17 00:00:00 2001 From: Y Date: Mon, 20 May 2019 19:32:34 +0200 Subject: [PATCH] nextcloud: a step towards a better configuration --- .../templates/nginx_lool.j2 | 4 ++-- .../templates/nginx_nextcloud.j2 | 21 +++++++------------ roles/nextcloud_back/tasks/main.yml | 3 ++- .../nextcloud_back/templates/nextcloud.ini.j2 | 20 ++++++++++++++++-- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/roles/dmz_nextcloud_front/templates/nginx_lool.j2 b/roles/dmz_nextcloud_front/templates/nginx_lool.j2 index 43e4d7f..844d022 100644 --- a/roles/dmz_nextcloud_front/templates/nginx_lool.j2 +++ b/roles/dmz_nextcloud_front/templates/nginx_lool.j2 @@ -3,8 +3,8 @@ # Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing. # Nextcloud BUG -location ~ {{http_pfx_nextcloud}}/index.php/apps/richdocuments/(?:css|js|img|l10n|assets) { - rewrite ^{{http_pfx_nextcloud}}/index.php/apps/richdocuments(.*)$ {{http_pfx_nextcloud}}/index.php/xapps/richdocuments$1$is_args$query_string; +location ~ (?:{{http_pfx_nextcloud}})+/index.php/apps/richdocuments/(?:css|js|img|l10n|assets) { + rewrite ^(?:{{http_pfx_nextcloud}})+/index.php/apps/richdocuments(.*)$ {{http_pfx_nextcloud}}/index.php/xapps/richdocuments$1$is_args$query_string; } # https://www.collaboraoffice.com/code/nginx-reverse-proxy/ diff --git a/roles/dmz_nextcloud_front/templates/nginx_nextcloud.j2 b/roles/dmz_nextcloud_front/templates/nginx_nextcloud.j2 index a287df7..9b9bc19 100644 --- a/roles/dmz_nextcloud_front/templates/nginx_nextcloud.j2 +++ b/roles/dmz_nextcloud_front/templates/nginx_nextcloud.j2 @@ -10,37 +10,32 @@ location ~ ^/\.well-known/ca(?:rd|l)dav { } location {{http_pfx_nextcloud}} { - # BUG Nextcloud/Polls - location ~ ^(?:{{http_pfx_nextcloud}})+/apps/polls { - rewrite ^(?:{{http_pfx_nextcloud}})+/apps/polls(.*)$ {{http_pfx_nextcloud}}/xapps/polls$1$is_args$query_string; - } - location {{http_pfx_nextcloud}} { - rewrite ^{{http_pfx_nextcloud}}(.*) {{http_pfx_nextcloud}}/index.php$1$is_args$query_string; + rewrite ^(?:{{http_pfx_nextcloud}})+(.*) {{http_pfx_nextcloud}}/index.php$1$is_args$query_string; } - location ~ ^{{http_pfx_nextcloud}}/(?:build|tests|config|lib|3rdparty|templates|data)/ { + location ~ ^(?:{{http_pfx_nextcloud}})+/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } - location ~ ^{{http_pfx_nextcloud}}/(?:\.|autotest|occ|issue|indie|db_|console) { + location ~ ^(?:{{http_pfx_nextcloud}})+/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } - location ~ ^(?:{{http_pfx_nextcloud}})+(/(?:(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12])\.php|(?:updater|ocs-provider)(?:/(?:.(? local routing / rewriting +#route-uri = ^ log:BEFORE: [${SCRIPT_FILENAME}] ${REQUEST_URI} = ${SCRIPT_NAME} ${PATH_INFO} route-uri = ^/xapps(/(?:[^?](? ${NEW_URL}) AS 404 +#error-route-uri = ^ return:404 +#error-route-label = checkOK +#error-route-uri = ^ log:*** CANCEL CHECK (${NEW_URL}) ;=> application settings env = NEXTCLOUD_CONFIG_DIR=%(nextcloud_conf)