Skip to content

Commit

Permalink
Disable IPv6 in Nginx if unsupported
Browse files Browse the repository at this point in the history
Relates to #73
  • Loading branch information
ckulka committed Sep 28, 2022
1 parent a77182c commit a77415e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions files/40-disable-nginx-ipv6-if-unsupported.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a77415e

Please sign in to comment.