【问题标题】:Self-signed https gitlab自签名 https gitlab
【发布时间】:2020-04-08 15:10:24
【问题描述】:

我想通过与 gitlab 的连接使用 https。

我执行了

openssl req -x509 -sha256 -days 365 -nodes -newkey rsa:2048 -keyout /etc/gitlab/ssl/172.29.128.166.key -out /etc/gitlab/ssl/172.29.128.166.crt

我的 gitlab.rb 如下

external_url "https://172.29.128.166:8929/"
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
nginx['ssl_certificate'] = "/etc/gitlab/ssl/172.29.128.166.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/172.29.128.166.key"

2 个问题:

1) 当我去http://172.29.128.166:8929/时,我得到了

400 Bad Request
The plain HTTP request was sent to HTTPS port
nginx

我已经指定了nginx['redirect_http_to_https'] = true,所以它不应该转到https吗?

2) 当我转到https://172.29.128.166:8929/ 时,我可以查看 GitLab。但是,我的 chrome 说它是“不安全的”。 我也可以看到证书无效。

我该如何解决这个问题?我是新手,谢谢

【问题讨论】:

    标签: ssl nginx openssl gitlab


    【解决方案1】:

    #1

    你试过没有“nginx['redirect_http_to_https_port'] = 80”。您已经在“nginx['redirect_http_to_https'] = true”中介绍了这一点。

    当在 external_url 中指定“https...”时,nginx 停止侦听端口 80。“nginx['redirect_http_to_https'] = true”告诉它重新开始侦听端口 80。您使用 redirect_http_to_https_port 是多余的/不必要的。

    #2

    但是,我的 chrome 显示它“不安全”。

    是的。浏览器按设计运行。自签名证书本质上是不受信任的,因为任何人都可以生成自签名证书。所以你每次都会收到警告。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-22
      • 2017-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-13
      相关资源
      最近更新 更多