From dddb0b26f319aed6d95fb2704cc8f6217fb0571a Mon Sep 17 00:00:00 2001 From: Joshua Pangborn Date: Sun, 6 Oct 2024 15:35:18 -0400 Subject: [PATCH 1/2] Update Unit Configuration --- .../etc/unit/config.d/ssl-full.json.template | 41 +++++++++++++++++-- .../etc/unit/config.d/ssl-mixed.json.template | 41 +++++++++++++++++-- .../etc/unit/config.d/ssl-off.json.template | 41 +++++++++++++++++-- 3 files changed, 111 insertions(+), 12 deletions(-) diff --git a/src/variations/unit/etc/unit/config.d/ssl-full.json.template b/src/variations/unit/etc/unit/config.d/ssl-full.json.template index d29391d51..90d18006b 100644 --- a/src/variations/unit/etc/unit/config.d/ssl-full.json.template +++ b/src/variations/unit/etc/unit/config.d/ssl-full.json.template @@ -97,6 +97,32 @@ "return": 200 } }, + { + "match": { + "uri": [ + "/.*", + "/.*/", + "/.*/*", + "/*/.*", + "/*/.*/", + "/*/.*/*" + ] + }, + "action": { + "return": 404 + } + }, + { + "match": { + "uri": [ + "/*.php", + "/*/*.php" + ] + }, + "action": { + "pass": "applications/php/direct" + } + }, { "match": { "uri": "!/index.php" @@ -104,7 +130,7 @@ "action": { "share": "${UNIT_WEBROOT}$uri", "fallback": { - "pass": "applications/php" + "pass": "applications/php/index" } } } @@ -118,17 +144,24 @@ "applications": { "php": { "type": "php", - "root": "${UNIT_WEBROOT}/", - "script": "index.php", "processes": { "max": ${UNIT_PROCESSES_MAX}, "spare": ${UNIT_PROCESSES_SPARE}, "idle_timeout": ${UNIT_PROCESSES_IDLE_TIMEOUT} } + "targets": { + "direct": { + "root": "${UNIT_WEBROOT}/" + }, + "index": { + "root": "${UNIT_WEBROOT}/", + "script": "index.php" + } + } } }, "access_log": { "if": "`${uri == '/healthcheck' ? false : true}`", "path": "/dev/stdout" } -} \ No newline at end of file +} diff --git a/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template b/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template index 2e39b833c..c13964d9b 100644 --- a/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template +++ b/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template @@ -78,6 +78,32 @@ "return": 200 } }, + { + "match": { + "uri": [ + "/.*", + "/.*/", + "/.*/*", + "/*/.*", + "/*/.*/", + "/*/.*/*" + ] + }, + "action": { + "return": 404 + } + }, + { + "match": { + "uri": [ + "/*.php", + "/*/*.php" + ] + }, + "action": { + "pass": "applications/php/direct" + } + }, { "match": { "uri": "!/index.php" @@ -85,7 +111,7 @@ "action": { "share": "${UNIT_WEBROOT}$uri", "fallback": { - "pass": "applications/php" + "pass": "applications/php/index" } } } @@ -98,17 +124,24 @@ "applications": { "php": { "type": "php", - "root": "${UNIT_WEBROOT}/", - "script": "index.php", "processes": { "max": ${UNIT_PROCESSES_MAX}, "spare": ${UNIT_PROCESSES_SPARE}, "idle_timeout": ${UNIT_PROCESSES_IDLE_TIMEOUT} } + "targets": { + "direct": { + "root": "${UNIT_WEBROOT}/" + }, + "index": { + "root": "${UNIT_WEBROOT}/", + "script": "index.php" + } + } } }, "access_log": { "if": "`${uri == '/healthcheck' ? false : true}`", "path": "/dev/stdout" } -} \ No newline at end of file +} diff --git a/src/variations/unit/etc/unit/config.d/ssl-off.json.template b/src/variations/unit/etc/unit/config.d/ssl-off.json.template index 02d75316c..06dfbcf66 100644 --- a/src/variations/unit/etc/unit/config.d/ssl-off.json.template +++ b/src/variations/unit/etc/unit/config.d/ssl-off.json.template @@ -41,6 +41,32 @@ "return": 200 } }, + { + "match": { + "uri": [ + "/.*", + "/.*/", + "/.*/*", + "/*/.*", + "/*/.*/", + "/*/.*/*" + ] + }, + "action": { + "return": 404 + } + }, + { + "match": { + "uri": [ + "/*.php", + "/*/*.php" + ] + }, + "action": { + "pass": "applications/php/direct" + } + }, { "match": { "uri": "!/index.php" @@ -48,7 +74,7 @@ "action": { "share": "${UNIT_WEBROOT}$uri", "fallback": { - "pass": "applications/php" + "pass": "applications/php/index" } } } @@ -61,17 +87,24 @@ "applications": { "php": { "type": "php", - "root": "${UNIT_WEBROOT}/", - "script": "index.php", "processes": { "max": ${UNIT_PROCESSES_MAX}, "spare": ${UNIT_PROCESSES_SPARE}, "idle_timeout": ${UNIT_PROCESSES_IDLE_TIMEOUT} } + "targets": { + "direct": { + "root": "${UNIT_WEBROOT}/" + }, + "index": { + "root": "${UNIT_WEBROOT}/", + "script": "index.php" + } + } } }, "access_log": { "if": "`${uri == '/healthcheck' ? false : true}`", "path": "/dev/stdout" } -} \ No newline at end of file +} From 1ae0ddf46aa663b0c8d04abf204894308c37edff Mon Sep 17 00:00:00 2001 From: Joshua Pangborn Date: Tue, 15 Oct 2024 16:01:25 -0400 Subject: [PATCH 2/2] Fix syntax error. --- src/variations/unit/etc/unit/config.d/ssl-full.json.template | 2 +- src/variations/unit/etc/unit/config.d/ssl-mixed.json.template | 2 +- src/variations/unit/etc/unit/config.d/ssl-off.json.template | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/variations/unit/etc/unit/config.d/ssl-full.json.template b/src/variations/unit/etc/unit/config.d/ssl-full.json.template index 90d18006b..9fcef79c7 100644 --- a/src/variations/unit/etc/unit/config.d/ssl-full.json.template +++ b/src/variations/unit/etc/unit/config.d/ssl-full.json.template @@ -148,7 +148,7 @@ "max": ${UNIT_PROCESSES_MAX}, "spare": ${UNIT_PROCESSES_SPARE}, "idle_timeout": ${UNIT_PROCESSES_IDLE_TIMEOUT} - } + }, "targets": { "direct": { "root": "${UNIT_WEBROOT}/" diff --git a/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template b/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template index c13964d9b..334db970c 100644 --- a/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template +++ b/src/variations/unit/etc/unit/config.d/ssl-mixed.json.template @@ -128,7 +128,7 @@ "max": ${UNIT_PROCESSES_MAX}, "spare": ${UNIT_PROCESSES_SPARE}, "idle_timeout": ${UNIT_PROCESSES_IDLE_TIMEOUT} - } + }, "targets": { "direct": { "root": "${UNIT_WEBROOT}/" diff --git a/src/variations/unit/etc/unit/config.d/ssl-off.json.template b/src/variations/unit/etc/unit/config.d/ssl-off.json.template index 06dfbcf66..2992891bc 100644 --- a/src/variations/unit/etc/unit/config.d/ssl-off.json.template +++ b/src/variations/unit/etc/unit/config.d/ssl-off.json.template @@ -91,7 +91,7 @@ "max": ${UNIT_PROCESSES_MAX}, "spare": ${UNIT_PROCESSES_SPARE}, "idle_timeout": ${UNIT_PROCESSES_IDLE_TIMEOUT} - } + }, "targets": { "direct": { "root": "${UNIT_WEBROOT}/"