From f25b0468eb9262e95753cbd2af977147d3bdb305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=A4=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D1=82?= Date: Mon, 4 May 2026 16:50:44 +0300 Subject: [PATCH] Update nextcloud.rst how-to instruction for NextCloud --- source/howto/nextcloud.rst | 371 +++++++++++++++++++++++++++---------- 1 file changed, 277 insertions(+), 94 deletions(-) diff --git a/source/howto/nextcloud.rst b/source/howto/nextcloud.rst index 24cf543a..1e29b7b1 100644 --- a/source/howto/nextcloud.rst +++ b/source/howto/nextcloud.rst @@ -43,124 +43,307 @@ platform using Unit: `_: .. code-block:: json - { + "settings": { + "http": { + "server_version": false, + "max_body_size": 1073741824, + "body_read_timeout": 300, + "header_read_timeout": 30, + "send_timeout": 60, + "idle_timeout": 180 + } + }, + "listeners": { "*:80": { - "pass": "routes" + "pass": "routes/nextcloud" } }, - "routes": [ - { - "match": { - ":nxt_hint:`uri `": [ - "/build/*", - "/tests/*", - "/config/*", - "/lib/*", - "/3rdparty/*", - "/templates/*", - "/data/*", - "/.*", - "/autotest*", - "/occ*", - "/issue*", - "/indie*", - "/db_*", - "/console*" - ] - }, - - "action": { - "return": 404 - } - }, - { - "match": { - ":nxt_hint:`uri `": [ - "/core/ajax/update.php*", - "/cron.php*", - "/index.php*", - "/ocm-provider*.php*", - "/ocs-provider*.php*", - "/ocs/v1.php*", - "/ocs/v2.php*", - "/public.php*", - "/remote.php*", - "/status.php*", - "/updater*.php*" - ] - }, - - "action": { - "pass": "applications/nextcloud/direct" - } - }, - { - "match": { - "uri": "/ocm-provider*" + "routes": { + "nextcloud": [ + { + "match": { + "uri": "/", + "headers": { + "User-Agent": "DavClnt*" + } + }, + "action": { + "return": 302, + "location": "/remote.php/webdav$request_uri" + } }, - "action": { - "pass": "applications/nextcloud/ocm" - } - }, - { - "match": { - "uri": "/ocs-provider*" + { + "match": { + "uri": "/" + }, + "action": { + "rewrite": "/index.php$request_uri", + "pass": "applications/nextcloud/direct", + "response_headers": { + "Referrer-Policy": "no-referrer", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "X-Permitted-Cross-Domain-Policies": "none", + "X-Robots-Tag": "noindex, nofollow" + } + } }, - "action": { - "pass": "applications/nextcloud/ocs" - } - }, - { - "match": { - "uri": "/updater*" + { + "match": { + "uri": "/robots.txt" + }, + "action": { + "share": ": ":nxt_ph:`/path/to/app `$uri" + } }, - "action": { - "pass": "applications/nextcloud/updater" - } - }, - { - "action": { - ":nxt_hint:`share `": ":nxt_ph:`/path/to/app `$uri", - "fallback": { - "pass": "applications/nextcloud/index" + { + "match": { + "uri": [ + "/.well-known/carddav", + "/.well-known/caldav" + ] + }, + "action": { + "return": 301, + "location": "/remote.php/dav/" + } + }, + + { + "match": { + "uri": [ + "/.well-known/acme-challenge/*", + "/.well-known/pki-validation/*" + ] + }, + "action": { + "share": ": ":nxt_ph:`/path/to/app `$uri", + "fallback": { + "return": 404 + } + } + }, + + { + "match": { + "uri": "/.well-known/*" + }, + "action": { + "return": 301, + "location": "/index.php$request_uri" + } + }, + + { + "match": { + ":nxt_hint:`uri `": [ + "/build", "/build/*", + "/tests", "/tests/*", + "/config", "/config/*", + "/lib", "/lib/*", + "/3rdparty", "/3rdparty/*", + "/templates", "/templates/*", + "/data", "/data/*" + ] + }, + "action": { + "return": 404 + } + }, + + { + "match": { + ":nxt_hint:`uri `": [ + "/.*", + "/autotest*", + "/occ*", + "/issue*", + "/indie*", + "/db_*", + "/console*" + ] + }, + "action": { + "return": 404 + } + }, + + { + "match": { + "uri": ["/ocs-provider", "/ocs-provider/"] + }, + "action": { + "rewrite": "/ocs-provider/index.php", + "pass": "applications/nextcloud/direct" + } + }, + + { + "match": { + "uri": ["/updater", "/updater/"] + }, + "action": { + "rewrite": "/updater/index.php", + "pass": "applications/nextcloud/direct" + } + }, + + { + "match": { + "uri": [ + "/index.php", "/index.php/*", + "/remote.php", "/remote.php/*", + "/public.php", "/public.php/*", + "/cron.php", + "/status.php", + "/ocs/v1.php", "/ocs/v1.php/*", + "/ocs/v2.php", "/ocs/v2.php/*", + "/ocs-provider/*.php", + "/core/ajax/update.php", + "/updater/*.php", "/updater/*.php/*", + "*/richdocumentscode/proxy.php", + "*/richdocumentscode_arm64/proxy.php" + ] + }, + "action": { + "pass": "applications/nextcloud/direct", + "response_headers": { + "Referrer-Policy": "no-referrer", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "X-Permitted-Cross-Domain-Policies": "none", + "X-Robots-Tag": "noindex, nofollow" + } + } + }, + + { + "match": { + "uri": [ + "*.php", + "*.php/*" + ] + }, + "action": { + "pass": "applications/nextcloud/index", + "response_headers": { + "Referrer-Policy": "no-referrer", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "X-Permitted-Cross-Domain-Policies": "none", + "X-Robots-Tag": "noindex, nofollow" + } + } + }, + + { + "match": { + "uri": "/remote/*" + }, + "action": { + "rewrite": "/remote.php$request_uri", + "pass": "applications/nextcloud/direct" + } + }, + + { + "match": { + "uri": [ + "*.css", "*.js", "*.mjs", "*.svg", + "*.gif", "*.ico", "*.jpg", "*.jpeg", + "*.png", "*.webp", "*.wasm", "*.tflite", + "*.map", "*.ogg", "*.flac", + "*.mp4", "*.webm" + ] + }, + "action": { + "share": ": ":nxt_ph:`/path/to/app `$uri", + "fallback": { + "pass": "applications/nextcloud/index", + "response_headers": { + "Referrer-Policy": "no-referrer", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "X-Permitted-Cross-Domain-Policies": "none", + "X-Robots-Tag": "noindex, nofollow" + } + }, + "response_headers": { + "Cache-Control": "public, max-age=15778463", + "Referrer-Policy": "no-referrer", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "X-Permitted-Cross-Domain-Policies": "none", + "X-Robots-Tag": "noindex, nofollow" + } + } + }, + + { + "match": { + "uri": [ + "*.otf", "*.woff", "*.woff2" + ] + }, + "action": { + "share": ": ":nxt_ph:`/path/to/app `$uri", + "fallback": { + "pass": "applications/nextcloud/index" + }, + "response_headers": { + "Cache-Control": "public, max-age=604800" + } + } + }, + + { + "action": { + "share": ": ":nxt_ph:`/path/to/app `$uri", + "fallback": { + "pass": "applications/nextcloud/index", + "response_headers": { + "Referrer-Policy": "no-referrer", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "X-Permitted-Cross-Domain-Policies": "none", + "X-Robots-Tag": "noindex, nofollow" + } + } } } - } - ], + ] + }, "applications": { "nextcloud": { "type": "php", + "limits": { + "timeout": 600, + "requests": 2000 + }, + "processes": { + "max": 64, + "spare": 16, + "idle_timeout": 60 + }, "targets": { "direct": { "root": ":nxt_ph:`/path/to/app/ `" }, - "index": { "root": ":nxt_ph:`/path/to/app/ `", "script": ":nxt_hint:`index.php `" - }, - - "ocm": { - "root": ":nxt_ph:`/path/to/app/ `ocm-provider/", - "script": ":nxt_hint:`index.php `" - }, - - "ocs": { - "root": ":nxt_ph:`/path/to/app/ `ocs-provider/", - "script": ":nxt_hint:`index.php `" - }, - - "updater": { - "root": ":nxt_ph:`/path/to/app/ `nextcloud/updater/", - "script": ":nxt_hint:`index.php `" } + }, + "environment": { + "modHeadersAvailable": "true", + "front_controller_active": "true" } } } @@ -181,11 +364,11 @@ platform using Unit: #. Adjust Unit's **max_body_size** :ref:`option ` to avoid potential issues with large file uploads, for example, runnig the - following command as root: + following command as root to set 10G limit: .. code-block:: console - # curl -X PUT -d '{"http":{"max_body_size": 2147483648}}' --unix-socket \ + # curl -X PUT -d '{"http":{"max_body_size": 10737418240}}' --unix-socket \ :nxt_ph:`/path/to/control.unit.sock ` :nxt_hint:`http://localhost/config/settings ` After a successful update, browse to http://localhost and `set up