From d165a26d2710a784197e5be873565a5f300b82e6 Mon Sep 17 00:00:00 2001 From: Christopher Bennell Date: Thu, 2 Oct 2025 22:57:18 -0400 Subject: [PATCH 1/2] Allow bind ports to be customized in .env Allow the Caddy bind ports to be customized with .env variables. This allows more versatile deployments behind reverse proxies without needing changes that will cause conflict when upgrading. --- .env.example | 6 ++++++ compose.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 5a5f269..8661fa0 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,12 @@ DOMAIN=example.com # You also need to uncomment the corresponding block in your Caddyfile # ADMIN_DOMAIN= +# Ghost ports +# Ports where Ghost will listen for HTTP traffic. +# Change these if the default ports are in use, or if Ghost is behind a reverse proxy. +HTTP_PORT=80 +HTTPS_PORT=443 + # Database settings # All database settings must not be changed once the database is initialised DATABASE_ROOT_PASSWORD=reallysecurerootpassword diff --git a/compose.yml b/compose.yml index 32ae177..2b7970c 100644 --- a/compose.yml +++ b/compose.yml @@ -5,8 +5,8 @@ services: image: caddy:2.10.0-alpine@sha256:e2e3a089760c453bc51c4e718342bd7032d6714f15b437db7121bfc2de2654a6 restart: always ports: - - "80:80" - - "443:443" + - "${HTTP_PORT}:80" + - "${HTTPS_PORT}:443" environment: DOMAIN: ${DOMAIN:?DOMAIN environment variable is required} ADMIN_DOMAIN: ${ADMIN_DOMAIN:-} From 9f17531b09dd536be46f3d1e49e8d85ccffff0fc Mon Sep 17 00:00:00 2001 From: Christopher Bennell Date: Thu, 2 Oct 2025 23:31:00 -0400 Subject: [PATCH 2/2] Update Caddy ports to use default values --- compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yml b/compose.yml index 2b7970c..5fc0fcc 100644 --- a/compose.yml +++ b/compose.yml @@ -5,8 +5,8 @@ services: image: caddy:2.10.0-alpine@sha256:e2e3a089760c453bc51c4e718342bd7032d6714f15b437db7121bfc2de2654a6 restart: always ports: - - "${HTTP_PORT}:80" - - "${HTTPS_PORT}:443" + - "${HTTP_PORT:-80}:80" + - "${HTTPS_PORT:-443}:443" environment: DOMAIN: ${DOMAIN:?DOMAIN environment variable is required} ADMIN_DOMAIN: ${ADMIN_DOMAIN:-}