From a3a2f630ac1fe486ff40b7bddca2fadac6d9932a Mon Sep 17 00:00:00 2001 From: Lukas Rosenstock Date: Fri, 19 Jun 2026 17:16:47 +0000 Subject: [PATCH] Allow dynamic Caddy port configuration --- .gitignore | 4 +++- init.sh | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index af3e284..fe688da 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,9 @@ build cache stacks config.php +Caddyfile .cache .config .local -*.phar \ No newline at end of file +*.phar +.phpunit.* \ No newline at end of file diff --git a/init.sh b/init.sh index ea0fc93..5f9e1b5 100644 --- a/init.sh +++ b/init.sh @@ -21,6 +21,22 @@ echo " Monolog\Logger::INFO, " \ " ); " > config.php +if [ ! -z $RUN_ON_HTTP_PORT ]; then + # We need to create a Caddyfile that exposes this port + echo "http://:$RUN_ON_HTTP_PORT {\n" \ + " root * /www/public/\n" \ + " php_fastcgi localhost:9000\n" \ + " try_files {path} /index.php\n" \ + " file_server\n" \ + " header -Via {\n" \ + " defer\n" \ + " }\n" \ + "}\n" > Caddyfile + + echo "Configured an HTTP (unencrypted) webserver on port $RUN_ON_HTTP_PORT"; +fi + # Make cache folder + mkdir cache chown www-data:www-data cache