From 111d9040a7eaebab824ae4009810d5111a7288ed Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 11 Aug 2026 12:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=A5=E5=BA=B7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=A4=B1=E8=B4=A5:=20nginx=E8=A1=A5=E4=B8=8AIPv6?= =?UTF-8?q?=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 首次部署时健康检查一直失败——容器内nginx只listen了IPv4(0.0.0.0:80), 但/etc/hosts里localhost解析到::1在前,wget http://localhost/因而连不上。 补上 listen [::]:80 双栈监听解决。部署脚本那边也同步改成直连127.0.0.1, 避免再依赖localhost的解析顺序。 --- docker/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/nginx.conf b/docker/nginx.conf index be64ad5a..54699d93 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -1,5 +1,6 @@ server { listen 80; + listen [::]:80; server_name _; root /usr/share/nginx/html; index index.html;