From bf036cbb8898a0c0725ff579be5a5ed029cd4b0a Mon Sep 17 00:00:00 2001 From: Russ Date: Sun, 5 Jan 2020 17:48:43 -0500 Subject: [PATCH] fix ipv6 resolver setup for nginx (#246) --- rootfs/etc/services.d/nginx/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/etc/services.d/nginx/run b/rootfs/etc/services.d/nginx/run index f6b59fd6..a72046b9 100755 --- a/rootfs/etc/services.d/nginx/run +++ b/rootfs/etc/services.d/nginx/run @@ -21,8 +21,8 @@ mkdir -p /tmp/nginx/body \ touch /var/log/nginx/error.log && chmod 777 /var/log/nginx/error.log && chmod -R 777 /var/cache/nginx chown root /tmp/nginx -# Dynamically generate resolvers file -echo resolver $(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ";" > /etc/nginx/conf.d/include/resolvers.conf +# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]` +echo resolver $(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ";" > /etc/nginx/conf.d/include/resolvers.conf # Generate dummy self-signed certificate. if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]