From 44fcdc20669875231e849bfceb04d517df5157e5 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Mon, 11 Aug 2014 20:17:38 +0200 Subject: [PATCH] owncloud properly working, but not in sub dir anymore --- conf/nginx.conf | 65 ++++++++++++++++++---------------- conf/zpush/backend_caldav.php | 2 +- conf/zpush/backend_carddav.php | 2 +- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 8cfc8831..f7ddb6df 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -23,59 +23,64 @@ server { include /etc/nginx/nginx-ssl.conf; # Expose this directory as static files. - root $ROOT; + # TODO: This is bad, we shouldnt hack it like this. + root /usr/local/lib/owncloud;; index index.html index.htm; # ownCloud configuration - # TODO: we should support owncloud to be loaded from www root, but for now we dont :-) client_max_body_size 10G; # set max upload size fastcgi_buffers 64 4K; + rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect; + rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect; + rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect; + + index index.php; + error_page 403 /core/templates/403.php; + error_page 404 /core/templates/404.php; + location = /robots.txt { allow all; log_not_found off; access_log off; } - error_page 403 /owncloud/core/templates/403.php; - error_page 404 /owncloud/core/templates/404.php; - - rewrite ^/caldav(.*)$ /owncloud/remote.php/caldav$1 redirect; - rewrite ^/carddav(.*)$ /owncloud/remote.php/carddav$1 redirect; - rewrite ^/webdav(.*)$ /owncloud/remote.php/webdav$1 redirect; - rewrite ^/owncloud$ /owncloud/ redirect; - rewrite ^/owncloud/$ /owncloud/index.php; - - location /owncloud/ { - index index.php; - alias /usr/local/lib/owncloud/; - } - - location ~ ^/owncloud/(.+?\.php)/? { - fastcgi_split_path_info ^/owncloud/(.+?\.php)(/?.*)$; - set $path_info $fastcgi_path_info; -# try_files $fastcgi_script_name = 404; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$fastcgi_script_name; - fastcgi_param PATH_INFO $path_info; - fastcgi_param HTTPS on; - fastcgi_param SCRIPT_NAME /owncloud/$fastcgi_script_name; - fastcgi_pass unix:/tmp/php-fastcgi.www-data.sock; - } - location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } + location / { + # The following 2 rules are only needed with webfinger + rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; + + rewrite ^/.well-known/carddav /remote.php/carddav/ redirect; + rewrite ^/.well-known/caldav /remote.php/caldav/ redirect; + + rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; + + try_files $uri $uri/ index.php; + } + + location ~ ^(.+?\.php)(/.*)?$ { + try_files $1 = 404; + + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$1; + fastcgi_param PATH_INFO $2; + fastcgi_param HTTPS on; + fastcgi_pass unix:/tmp/php-fastcgi.www-data.sock; + } + # Optional: set long EXPIRES header on static assets - location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { + location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires 30d; # Optional: Don't log access to assets access_log off; } # Webfinger configuration. - # TODO: fix this for owncloud: http://doc.owncloud.org/server/5.0/admin_manual/installation/installation_others.html + # TODO: fix this for owncloud location = /.well-known/webfinger { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/local/bin/mailinabox-webfinger.php; diff --git a/conf/zpush/backend_caldav.php b/conf/zpush/backend_caldav.php index 45fb03fa..4170fed4 100644 --- a/conf/zpush/backend_caldav.php +++ b/conf/zpush/backend_caldav.php @@ -52,7 +52,7 @@ define('CALDAV_SERVER', 'https://localhost'); define('CALDAV_PORT', '443'); // Path -define('CALDAV_PATH', '/owncloud/remote.php/caldav/calendars/%u/'); +define('CALDAV_PATH', '/remote.php/caldav/calendars/%u/'); // Personal CalDAV folder (calendar folder/principal) define('CALDAV_PERSONAL', ''); diff --git a/conf/zpush/backend_carddav.php b/conf/zpush/backend_carddav.php index 206fcc5d..0e91f2a6 100644 --- a/conf/zpush/backend_carddav.php +++ b/conf/zpush/backend_carddav.php @@ -71,7 +71,7 @@ define('CARDDAV_PATH', '/remote.php/carddav/addressbooks/%u/'); // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_DEFAULT_PATH', '/owncloud/remote.php/carddav/addressbooks/%u/contacts/'); +define('CARDDAV_DEFAULT_PATH', '/remote.php/carddav/addressbooks/%u/contacts/'); // Server path to the GAL addressbook. This addressbook is readonly and searchable by the user, but it will NOT be synced. // If you don't want GAL, comment it