【问题标题】:How do I use Let’s Encrypt with GitLab under Plesk on Subdomain?如何在子域的 Plesk 下使用 Let's Encrypt 和 GitLab?
【发布时间】:2016-10-17 16:57:19
【问题描述】:

我启动并运行了 GitLab,但目前它不使用 SSL。我通常使用 Let's Encrypt Plesk Extension 来获得免费的 SSL 证书。 这是我的设置的样子:

  • Plesk v12.5.30_build1205150826.19 os_Ubuntu 14.04
  • GitLab 8.8.5
  • 让我们加密 Plesk 扩展 v1.6 第 1 版
  • Plesk 子域:git.my-domain.com

git.my-domain.com 的 Plesk Apache 和 nginx 设置:

Additional directives for HTTP :
<Location />
    ProxyPass http://IP-of-my-domain:9999/
    ProxyPassReverse http://IP-of-my-domain:9999/
</Location>
Additional directives for HTTPS :
<Location />
     ProxyPass https://IP-of-my-domain:9998/
     ProxyPassReverse https://IP-of-my-domain:9998/
  </Location>

在我的 gitlab.rb 文件中:

external_url "http://IP-of-my-domain:9999/"

我还找到了How do I use let’s encrypt with gitlab? 并尝试调整答案,但不知道该输入什么:

nginx['custom_gitlab_server_config']="?"
nginx['custom_gitlab_mattermost_server_config']="?"

Http 连接工作正常(子域或 IP:端口,两者都工作)。一旦我更改为 Https,它就没有,我得到以下信息(如果我将 external_url 更改为端口 9998):

服务不可用

由于维护停机或容量问题,服务器暂时无法满足您的请求。请稍后再试。

此外,在尝试使用 ErrorDocument 处理请求时遇到 503 Service Unavailable 错误。

在没有 ProxyPass 条目的情况下,在 ProxyPass 和 https 工作之前安装证书没有任何问题(即证书存在并且有效)。

如果有人通过 Let's Encrypt 启动并运行 Plesk 和 GitLab,如果您能分享您的配置,我将不胜感激。

【问题讨论】:

    标签: ssl-certificate subdomain gitlab plesk lets-encrypt


    【解决方案1】:

    我在 /etc/gitlab/ssl 中创建了指向我的证书的符号链接

    1. subdomain.domain.tld.crt => /opt/psa/var/modules/letsencrypt/etc/archive/subdomain.domain.tld/cert1.pem

    2. subdomain.domain.tld.key => /opt/psa/var/modules/letsencrypt/etc/archive/subdomain.domain.tld/privkey1.pem

    在 gitlab.rb 文件中

    external_url 'https://gitlab.domain.tld'
    gitlab_rails['gitlab_shell_ssh_port'] = 22 
    gitlab_rails['initial_shared_runners_registration_token'] = "token"
    web_server['external_users'] = ['webUser']
    nginx['enable'] = false  # Tutorial
    nginx['redirect_http_to_https'] = true      
    nginx['listen_https'] = false
    

    在 Plesk 中:域 => Apache 和 nginx 设置 => 其他 nginx 指令

     location ~ / {
            # for omnibus installation
            root /opt/gitlab/embedded/service/gitlab-rails/public;
            try_files $uri $uri/index.html $uri.html @gitlab;
        }
    
        # if a file, which is not found in the root folder is requested,
        # then the proxy pass the request to the upsteam (gitlab unicorn)
        location @gitlab {
            proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
            proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
            proxy_redirect     off;
    
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header   Host              $http_host;
            proxy_set_header   X-Real-IP         $remote_addr;
    
            proxy_pass http://gitlab;
    
        }
    

    在文件 gitlab.conf 中

      upstream gitlab {
            # for omnibus installation
            server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
        }
    

    【讨论】:

      猜你喜欢
      • 2021-06-20
      • 2016-08-09
      • 2018-08-27
      • 1970-01-01
      • 2021-04-30
      • 1970-01-01
      • 1970-01-01
      • 2016-12-18
      • 1970-01-01
      相关资源
      最近更新 更多