nginx.tmpl 配置有误: proxy_pass {{ trim $proto }} 在容器之间导致 502 Bad Gateway
作者: IAMtheIAM创建于 2019年7月4日更新于 2026年6月20日
https://GitHub.com/evertramos/Docker-compose-letsencrypt-nginx-proxy-companion/blob/621798e92235b6eb75e0d34d3b6209dfee96ff7d/nginx.tmpl#L284 这个代码行有问题。 `proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};` 会导致问题。 `{{ trim $proto }}` 会被翻译为 `https`,这会导致 502 Bad Gateway 错误。如果我将其改为 ` proxy_pass http://{{ trim $upstream_name }};`,那么我的新容器就会被 nginx 发现并正确加载。
内容来源: nginx-proxy/nginx-proxy