diff --git a/docker/unit.json b/docker/unit.json index c8535e7d6..49bd59402 100644 --- a/docker/unit.json +++ b/docker/unit.json @@ -1,115 +1,185 @@ { - "listeners": { - "*:80": { - "pass": "routes" - } - }, - "routes": [ - { - "match": { - "uri": [ - "!*/.well-known/*", - "/vendor/*", - "/core/profiles/demo_umami/modules/demo_umami_content/default_content/*", - "*.engine", - "*.inc", - "*.install", - "*.make", - "*.module", - "*.po", - "*.profile", - "*.sh", - "*.theme", - "*.tpl", - "*.twig", - "*.xtmpl", - "*.yml", - "*/.*", - "*/Entries*", - "*/Repository", - "*/Root", - "*/Tag", - "*/Template", - "*/composer.json", - "*/composer.lock", - "*/web.config", - "*sql", - "*.bak", - "*.orig", - "*.save", - "*.swo", - "*.swp", - "*~" - ] - }, - "action": { - "return": 404 - } - }, - { - "match": { - "uri": [ - "/core/authorize.php", - "/core/install.php", - "/core/modules/statistics/statistics.php", - "~^/core/modules/system/tests/https?\\.php", - "/core/rebuild.php", - "/update.php", - "/update.php/*" - ] - }, - "action": { - "pass": "applications/drupal/direct" - } - }, - { - "match": { - "uri": [ - "!/index.php*", - "*.php" - ] - }, - "action": { - "return": 404 - } - }, - { - "action": { - "share": "/var/www/html/web$uri", - "fallback": { - "pass": "applications/drupal/index" - } - } - } - ], - "applications": { - "drupal": { - "type": "php", - "processes": { - "max": 4, - "spare": 2, - "idle_timeout": 120 - }, - "limits": { - "timeout": 300, - "requests": 1500 - }, - "options": { - "admin": { - "memory_limit": "1G", - "opcache.jit_buffer_size": "20M" - } - }, - "targets": { - "direct": { - "root": "/var/www/html/web/" - }, - "index": { - "root": "/var/www/html/web/", - "script": "index.php" - } - } - } - }, - "access_log": "/dev/stdout" + "access_log": "/dev/stdout", + "listeners": { + "*:80": { + "pass": "routes/main" + } + }, + + "routes": { + "main": [ + { + "match": { + "uri": [ + "!*/.well-known/*", + "/vendor/*", + "/core/profiles/demo_umami/modules/demo_umami_content/default_content/*", + "*.engine", + "*.inc", + "*.install", + "*.make", + "*.module", + "*.po", + "*.profile", + "*.sh", + "*.theme", + "*.tpl", + "*.twig", + "*.xtmpl", + "*.yml", + "*/.*", + "*/Entries*", + "*/Repository", + "*/Root", + "*/Tag", + "*/Template", + "*/composer.json", + "*/composer.lock", + "*/web.config", + "*sql", + "*.bak", + "*.orig", + "*.save", + "*.swo", + "*.swp", + "*~" + ] + }, + + "action": { + "return": 404 + } + }, + { + "match": { + "uri": [ + "/core/authorize.php", + "/core/install.php", + "/core/modules/statistics/statistics.php", + "~^/core/modules/system/tests/https?\\.php", + "/core/rebuild.php", + "/update.php", + "/update.php/*" + ] + }, + + "action": { + "pass": "applications/drupal/direct" + } + }, + { + "match": { + "uri": [ + "!/index.php*", + "*.php" + ] + }, + + "action": { + "return": 404 + } + }, + { + "match": { + "uri": [ + "~^.*css_[a-zA-Z0-9-_]+\\.css(?:\\?.*)?$", + "~^.*js_[a-zA-Z0-9-_]+\\.js(?:\\?.*)?$" + ], + + "headers": [ + { + "Accept-Encoding": "*gzip*" + } + ] + }, + + "action": { + "pass": "routes/assets_gz" + } + }, + { + "action": { + "share": "/var/www/html/web$uri", + "fallback": { + "pass": "applications/drupal/index" + } + } + } + ], + + "assets_gz": [ + { + "match": { + "headers": [ + { + "Accept-Encoding": "*gzip*" + } + ] + }, + + "action": { + "share": "/var/www/html/web${uri}.gz", + "response_headers": { + "Content-Encoding": "gzip" + }, + + "fallback": { + "pass": "routes/assets" + } + } + }, + { + "action": { + "pass": "routes/assets" + } + } + ], + + "assets": [ + { + "action": { + "share": "/var/www/html/web${uri}", + "fallback": { + "pass": "applications/drupal/index" + } + } + } + ] + }, + + "applications": { + "drupal": { + "type": "php", + "stdout": "/dev/stdout", + "stderr": "/dev/stderr", + "processes": { + "max": 4, + "spare": 2, + "idle_timeout": 120 + }, + + "limits": { + "timeout": 300, + "requests": 1500 + }, + + "options": { + "admin": { + "memory_limit": "1G", + "opcache.jit_buffer_size": "20M" + } + }, + + "targets": { + "direct": { + "root": "/var/www/html/web/" + }, + + "index": { + "root": "/var/www/html/web/", + "script": "index.php" + } + } + } + } }