owncloud: support MOD_X_ACCEL_REDIRECT_ENABLED

This lets downloads from the file app work.
This commit is contained in:
Joshua Tauberer 2014-08-15 23:10:05 +00:00
parent 398b538e2b
commit 8c9f278166
2 changed files with 9 additions and 7 deletions

View file

@ -72,6 +72,14 @@ server {
client_max_body_size 1G; client_max_body_size 1G;
fastcgi_buffers 64 4K; 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).*)$ { location ~ ^/((caldav|carddav|webdav).*)$ {
# Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either. # 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; 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 /cloud/public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /cloud/public.php?service=host-meta-json last; rewrite ^/.well-known/host-meta.json /cloud/public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect; rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect;

View file

@ -79,6 +79,7 @@ def make_domain_config(domain, template, env):
# Replace substitution strings in the template & return. # Replace substitution strings in the template & return.
nginx_conf = template 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("$HOSTNAME", domain)
nginx_conf = nginx_conf.replace("$ROOT", root) nginx_conf = nginx_conf.replace("$ROOT", root)
nginx_conf = nginx_conf.replace("$SSL_KEY", ssl_key) nginx_conf = nginx_conf.replace("$SSL_KEY", ssl_key)