docker - Gitlab-ce docker容器无法通过https访问

标签 docker gitlab

我在通过 https 访问本地 gitlab 时遇到问题。
我在 Ubuntu/Redhat 8 上安装了它,结果相同,端口 443 无法访问。
在/etc/gitlab/ssl/我创建了一个自签名证书和 key

xxx.crt
xxx.key

然后配置它,我按照这里给出的说明进行操作。 https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#manually-configuring-https .我遇到的问题是我无法通过 https 连接到 gitlab。 http 工作得很好

奇怪的行为:
根据文档默认情况下,当您指定以“https”开头的 external_url 时,NGINX 将不再监听端口 80 上的未加密 HTTP 流量。但即使设置了 external_url,情况也并非如此。

所以我在配置后检查了/var/opt/gitlab/nginx/conf/gitlab-http.conf,我看到服务器端口仍然指向*:80。我将其更改为 443 停止/启动 getlab 容器,它因无法访问而中断。

为了让它恢复工作,我恢复了更改并执行了以下操作:
gitlab-ctl reconfigure
sudo docker restart gitlab

现在它重新响应端口 80 而不是 443。

最佳答案

http works just fine



HTTP 不应该工作,请参阅“Redirect HTTP requests to HTTPS

By default, when you specify an external_url starting with 'https', NGINX will no longer listen for unencrypted HTTP traffic on port 80.
If you want to redirect all HTTP traffic to HTTPS you can use the redirect_http_to_https setting.


external_url "https://gitlab.example.com"
nginx['redirect_http_to_https'] = true

所以仔细检查你的gitlab.rb ,然后 sudo gitlab-ctl reconfigure

关于docker - Gitlab-ce docker容器无法通过https访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58151769/

相关文章:

ruby-on-rails - docker + rails + redis - 救援人员没有运行

python - 如何在 kubernetes 中运行从另一个启动的 docker 镜像并传递参数

java - 当将 `openjdk:11` 或 `openjdk:8` 与 CGroup 的实验标志一起使用时,是否仍需要 `-Xmx`

http - 升级到 6.5 后,Gitlab 无法通过 HTTP 克隆

docker - GitLab CD工作流将Docker应用程序部署到登台和生产中

docker - 无法通过容器IP访问Docker容器

docker - gitlab docker 登录失败 : certificate signed by unknown authority

xcode - Gitlab - Xcode 无法连接远程存储库

ubuntu - 启动服务器后 Ubuntu 14.04 上的 "GitLab is not responding."502

linux - 单个容器中的 Docker 多服务