From b2e67a6eded8b1c17f3bdcfa271ec17e9c3546f2 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Wed, 10 Sep 2014 21:24:27 +0200 Subject: [PATCH 1/6] increase timeouts for z-push, was closeing sync connections to early --- conf/nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d1786b78..07e063b5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -57,7 +57,8 @@ server { include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/local/lib/z-push/index.php; fastcgi_param PHP_VALUE "include_path=.:/usr/share/php:/usr/share/pear:/usr/share/awl/inc"; - fastcgi_read_timeout 630; + fastcgi_read_timeout 1750s; + fastcgi_send_timeout 1750s; fastcgi_pass php-fpm; } location /autodiscover/autodiscover.xml { From c87da5330c91e7fe509d9c390fb6bef2c538c6b1 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Wed, 10 Sep 2014 21:27:59 +0200 Subject: [PATCH 2/6] dont log robots.txt and favicon.ico. we should REALLY consider creating seperate include files for *all* of our "apps", this is getting messy.. --- conf/nginx.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 07e063b5..37c46411 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -24,6 +24,16 @@ server { root $ROOT; index index.html index.htm; + location = /robots.txt { + log_not_found off; + access_log off; + } + + location = /favicon.ico { + log_not_found off; + access_log off; + } + # Roundcube Webmail configuration. rewrite ^/mail$ /mail/ redirect; rewrite ^/mail/$ /mail/index.php; From 487e0d64e2878825062be471ac5c01cb1b553a0c Mon Sep 17 00:00:00 2001 From: jkaberg Date: Wed, 10 Sep 2014 22:12:16 +0200 Subject: [PATCH 3/6] dont log excessive dav related requests --- conf/nginx-primaryonly.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index 321194ad..f39db20c 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -15,6 +15,11 @@ location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } + location ~ /remote.php/ { + # Don't log requests that uses DAV (results in heavy spam) + log_not_found off; + access_log off; + } } location ~ ^(/cloud)(/[^/]+\.php)(/.*)?$ { # note: ~ has precendence over a regular location block @@ -41,6 +46,9 @@ # Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either. # Properly proxying like this seems to work fine. proxy_pass https://$HOSTNAME/cloud/remote.php/$1; + + # Don't log requests that uses DAV (results in heavy spam) + access_log off; } 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; From f375aab733bf84253878bfd30cad0488e0bb2301 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Wed, 10 Sep 2014 22:14:20 +0200 Subject: [PATCH 4/6] put ownCloud logs in separate log files --- conf/nginx-primaryonly.conf | 5 +++++ setup/owncloud.sh | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index f39db20c..47d1bd9f 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -11,7 +11,12 @@ rewrite ^/cloud/(contacts|calendar|files)$ /cloud/index.php/apps/$1/ redirect; rewrite ^(/cloud/core/doc/[^\/]+/)$ $1/index.html; location /cloud/ { + + access_log /var/log/owncloud/access.log; + error_log /var/log/owncloud/error.log; + alias /usr/local/lib/owncloud/; + location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } diff --git a/setup/owncloud.sh b/setup/owncloud.sh index 65903220..6db86192 100755 --- a/setup/owncloud.sh +++ b/setup/owncloud.sh @@ -90,9 +90,10 @@ EOF ?> EOF - # Create user data directory and set permissions + # Create user data directory, log directory and set permissions mkdir -p $STORAGE_ROOT/owncloud - chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud + mkdir -p /var/log/owncloud + chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud /var/log/owncloud # Execute ownCloud's setup step, which creates the ownCloud sqlite database. # It also wipes it if it exists. And it deletes the autoconfig.php file. From 7960f2ba2c3a044c5e4bbaea2e88ab2ee72ae31f Mon Sep 17 00:00:00 2001 From: jkaberg Date: Wed, 10 Sep 2014 22:19:43 +0200 Subject: [PATCH 5/6] use regexp instead to ignore --- conf/nginx-primaryonly.conf | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index 47d1bd9f..db353d36 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -20,11 +20,6 @@ location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } - location ~ /remote.php/ { - # Don't log requests that uses DAV (results in heavy spam) - log_not_found off; - access_log off; - } } location ~ ^(/cloud)(/[^/]+\.php)(/.*)?$ { # note: ~ has precendence over a regular location block @@ -47,6 +42,10 @@ internal; alias $STORAGE_ROOT/owncloud; } + location ~ ^/cloud/remote.php/(caldav|webdav|carddav)(.*)$ { + # Don't log requests that uses DAV (results in heavy spam) + access_log off; + } location ~ ^/((caldav|carddav|webdav).*)$ { # Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either. # Properly proxying like this seems to work fine. From 6fc6b1e6a17946223604f8da7c8530ed9cb2f114 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Wed, 10 Sep 2014 22:40:24 +0200 Subject: [PATCH 6/6] ownCloud uses separate log location, but ignores regexp access_log --- conf/nginx-primaryonly.conf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index db353d36..74967eb2 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -11,18 +11,22 @@ rewrite ^/cloud/(contacts|calendar|files)$ /cloud/index.php/apps/$1/ redirect; rewrite ^(/cloud/core/doc/[^\/]+/)$ $1/index.html; location /cloud/ { - - access_log /var/log/owncloud/access.log; - error_log /var/log/owncloud/error.log; - alias /usr/local/lib/owncloud/; location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } + location ~ ^/((caldav|webdav|carddav).*)$ { + # Don't log requests that uses DAV (results in heavy spam) + access_log off; + } } location ~ ^(/cloud)(/[^/]+\.php)(/.*)?$ { # note: ~ has precendence over a regular location block + + access_log /var/log/owncloud/access.log; + error_log /var/log/owncloud/error.log; + include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$2; fastcgi_param SCRIPT_NAME $1$2; @@ -42,10 +46,6 @@ internal; alias $STORAGE_ROOT/owncloud; } - location ~ ^/cloud/remote.php/(caldav|webdav|carddav)(.*)$ { - # Don't log requests that uses DAV (results in heavy spam) - access_log off; - } location ~ ^/((caldav|carddav|webdav).*)$ { # Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either. # Properly proxying like this seems to work fine.