nginx: Don't resolve with IPv6, only cache for 60s

This commit updates the default resolver configuration for Nginx servers
to not attempt to resolve IPv6 addresses, and only holds resolved IPs
for a maximum of 60 seconds, in order to avoid issues with stale cache.
This commit is contained in:
Alex Palaistras 2021-11-27 17:45:16 +00:00
parent 79e742d4b7
commit 85d4b221f4

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Set NGINX resolver from system-wide configuration.
awk '/^nameserver/ {printf "resolver %s;\n", $2; exit}' /etc/resolv.conf > /etc/nginx/resolver.conf
awk '/^nameserver/ {printf "resolver %s valid=60s ipv6=off;\n", $2; exit}' /etc/resolv.conf > /etc/nginx/resolver.conf
# Start NGINX as foreground process.
nginx -g 'daemon off;'