From 7dab6c63d1daf37281c624a73d236a21cdf23934 Mon Sep 17 00:00:00 2001 From: Stephen Ritz <127270018+smpaz7467@users.noreply.github.com> Date: Tue, 14 Jul 2026 14:54:28 -0700 Subject: [PATCH] [Nginx] only bind IPv6 default_server when ENABLE_IPV6 is set The HTTP-to-HTTPS redirect server block bound `listen [::]:{{ HTTP_PORT }} default_server` unconditionally, while every other IPv6 listen directive in this template is guarded by `{% if ENABLE_IPV6 %}`. On hosts where IPv6 is disabled at the kernel level, nginx cannot bind `::` and fails to start. This only triggers when HTTP_REDIRECT is enabled and ENABLE_IPV6 is false, which is why it survives testing with ENABLE_IPV6=false alone. Guard the directive like the other six IPv6 listeners in the template. Refs #7296 Co-Authored-By: Claude Opus 4.8 (1M context) --- data/conf/nginx/templates/nginx.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/conf/nginx/templates/nginx.conf.j2 b/data/conf/nginx/templates/nginx.conf.j2 index 08a85a144..8f7e5a24f 100644 --- a/data/conf/nginx/templates/nginx.conf.j2 +++ b/data/conf/nginx/templates/nginx.conf.j2 @@ -47,7 +47,9 @@ http { server { root /web; listen {{ HTTP_PORT }} default_server; + {% if ENABLE_IPV6 %} listen [::]:{{ HTTP_PORT }} default_server; + {%endif%} server_name {{ MAILCOW_HOSTNAME }} autodiscover.* autoconfig.* mta-sts.* {{ ADDITIONAL_SERVER_NAMES | join(' ') }};