From 8c9f2781669cf18c6e693eb157c9d013d536b00b Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Fri, 15 Aug 2014 23:10:05 +0000 Subject: [PATCH] owncloud: support MOD_X_ACCEL_REDIRECT_ENABLED This lets downloads from the file app work. --- conf/nginx.conf | 15 ++++++++------- management/web_update.py | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a16e137..e7aa501 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -72,6 +72,14 @@ server { client_max_body_size 1G; fastcgi_buffers 64 4K; } + location ^~ /cloud/data { + # In order to support MOD_X_ACCEL_REDIRECT_ENABLED, we need to expose + # the data directory but only allow 'internal' redirects within nginx + # so that this is not exposed to the world. + internal; + alias $STORAGE_ROOT/owncloud; + } + location ~ ^/((caldav|carddav|webdav).*)$ { # Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either. @@ -79,13 +87,6 @@ server { proxy_pass https://$HOSTNAME/cloud/remote.php/$1; } -# location ^~ /cloud/data { -# internal; -# # Set 'alias' if not using the default 'datadirectory' -# # TODO: Since this is auto generated, we need a better approach! -# alias /home/user-data/owncloud; -# } - rewrite ^/.well-known/host-meta /cloud/public.php?service=host-meta last; rewrite ^/.well-known/host-meta.json /cloud/public.php?service=host-meta-json last; rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect; diff --git a/management/web_update.py b/management/web_update.py index 0704c26..0665156 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -79,6 +79,7 @@ def make_domain_config(domain, template, env): # Replace substitution strings in the template & return. nginx_conf = template + nginx_conf = nginx_conf.replace("$STORAGE_ROOT", env['STORAGE_ROOT']) nginx_conf = nginx_conf.replace("$HOSTNAME", domain) nginx_conf = nginx_conf.replace("$ROOT", root) nginx_conf = nginx_conf.replace("$SSL_KEY", ssl_key)