我在通过 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 theredirect_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/