From a77415e1b231be7208675bd0aa07c8fec5ca687d Mon Sep 17 00:00:00 2001 From: ckulka Date: Sun, 30 Jan 2022 22:38:14 +0100 Subject: [PATCH] Disable IPv6 in Nginx if unsupported Relates to #73 --- files/40-disable-nginx-ipv6-if-unsupported.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 files/40-disable-nginx-ipv6-if-unsupported.sh diff --git a/files/40-disable-nginx-ipv6-if-unsupported.sh b/files/40-disable-nginx-ipv6-if-unsupported.sh new file mode 100755 index 0000000..374d9ca --- /dev/null +++ b/files/40-disable-nginx-ipv6-if-unsupported.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Based on /etc/docker-entrypoint.d/10-listen-on-ipv6-by-default.sh, since the +# same one cannot be used because the checksum of the default.conf differs. + +set -e +ME=$(basename $0) + +# Disable IPv6 configuration if not supported or nginx is not installed +# Added to resolve https://github.com/ckulka/baikal-docker/issues/73 +if nginx -t 2>&1 >/dev/null | grep -q '\[emerg\] socket() \[::\]:80 failed (97: Address family not supported by protocol)'; then + echo >&3 "$ME: info: Disable IPv6 in configuration" + sed -i 's/listen \[::\]:80;/# listen \[::\]:80/' /etc/nginx/conf.d/default.conf +fi