From 0d74bd05ff9d967e5d431d6707a6d8d19fb63f4d Mon Sep 17 00:00:00 2001 From: Dale Davies Date: Wed, 1 Mar 2023 14:55:43 +0000 Subject: [PATCH] Issue #58: Add config option to disable IPv6 support in nginx --- README.md | 1 + docker/entrypoint.sh | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 183133f..1d231a0 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ You can use the following optional environment variables to configure/customise - `NOINDEX: 'true'` - Include a robots noindex meta tag in site header. - `CACHEBYPASS: 'true'` - Bypass all caches, useful for testing changes. - `WWWURL` - Useful if Jump is hosted in a sub-directory (e.g. "/startpage"). +- `DISABLEIPV6` - Disable IPV6 if required. **NOTE:** The `OWMAPIKEY` and `LATLONG` config options must be defined together. diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index aeed216..f28387c 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -68,16 +68,27 @@ if [ -z "${DEVELOPMENT-}" ]; then fi fi - echo >&2 ""; - echo >&2 "- All done! Starting nginx/php services now." - echo >&2 ""; - echo >&2 "-------------------------------------------------------------" - echo >&2 ""; - else + echo >&2 ""; echo >&2 "- Setting correct ownership of xdebug dir" chown -R jumpapp:jumpapp /tmp/xdebug fi +DISABLEIPV6=$(echo "${DISABLEIPV6:-}" | tr '[:upper:]' '[:lower:]') + +if [ "$DISABLEIPV6" == "true" ] || [ "$DISABLEIPV6" == "1" ]; then + echo >&2 ""; + echo >&2 "- Disabling IPv6 in nginx config" + sed -E -i 's/^([^#]*)listen \[::\]/\1#listen [::]/g' /etc/nginx/nginx.conf +else + sed -E -i 's/^(\s*)#listen \[::\]/\1listen [::]/g' /etc/nginx/nginx.conf +fi + +echo >&2 ""; +echo >&2 "- All done! Starting nginx/php services now." +echo >&2 ""; +echo >&2 "-------------------------------------------------------------" +echo >&2 ""; + php-fpm8 nginx -g 'daemon off;'