You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker部署Gitlab后,外部Nginx反向代理出现8080连接拒绝问题

问题:Docker部署GitLab后配置外部Nginx反向代理出现127.0.0.1:8080连接拒绝错误

部署环境与初始命令

我通过Docker部署GitLab EE,执行的部署命令如下:

sudo docker run --detach \
  --hostname git.xxx.com \
  --publish 8443:443 --publish 880:80 --publish 822:22 \
  --name gitlab \
  --restart always \
  --volume $GITLAB_HOME/config:/etc/gitlab \
  --volume $GITLAB_HOME/logs:/var/log/gitlab \
  --volume $GITLAB_HOME/data:/var/opt/gitlab \
  --shm-size 256m \
  gitlab/gitlab-ee:latest

外部Nginx配置修改

为替换容器内置的Nginx,使用自行安装的Nginx做反向代理,我在gitlab.rb中添加了以下配置:

# Define the external url
external_url 'http://git.stupidpz.com'

# Disable the built-in nginx
nginx['enable'] = false

# Disable the built-in puma
puma['enable'] = false

# Set the internal API URL
gitlab_rails['internal_api_url'] = 'http://git.stupidpz.com'

# Define the web server process user (ubuntu/nginx)
web_server['external_users'] = ['nginx']

错误日志

配置完成后GitLab无法访问,在/var/log/gitlab/gitlab_workhorse/current日志文件中发现重复的连接错误:

{"correlation_id":"","duration_ms":0,"error":"badgateway: failed to receive response: dial tcp 127.0.0.1:8080: connect: connection refused","level":"error","method":"GET","msg":"","time":"2023-01-25T20:57:21Z","uri":""}
{"correlation_id":"","duration_ms":0,"error":"badgateway: failed to receive response: dial tcp 127.0.0.1:8080: connect: connection refused","level":"error","method":"GET","msg":"","time":"2023-01-25T20:57:31Z","uri":""}
{"correlation_id":"","duration_ms":0,"error":"badgateway: failed to receive response: dial tcp 127.0.0.1:8080: connect: connection refused","level":"error","method":"GET","msg":"","time":"2023-01-25T20:57:41Z","uri":""}
{"correlation_id":"","duration_ms":0,"error":"badgateway: failed to receive response: dial tcp 127.0.0.1:8080: connect: connection refused","level":"error","method":"GET","msg":"","time":"2023-01-25T20:57:51Z","uri":""}

核心疑问

除修改gitlab.rb外未进行其他操作,想明确该错误中dial tcp 127.0.0.1:8080的来源是什么。


内容的提问来源于stack exchange,提问作者StupidPz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 13:01:04