gitlab与apache连接拒绝

时间:2017-04-18 15:07:41

标签: ssl gitlab

我在使用gitlab在我的服务器上工作时遇到了麻烦 环境是:
Ubuntu 16.04.1 LTS
Apache 2.4

我通过omnibus脚本安装了gitlab,编辑了gitlab.rb以使其与apache一起工作,使vhost专用,与SSL证书有点挣扎,让它运行起来,但我遇到了错误我的问题无法解决。

当我去https://gitlab.mydomain.com/users/sign_in时,我有一个很好的503。 错误日志说:

[Tue Apr 18 16:58:56.556702 2017] [proxy:error] [pid 31966] (111)Connection refused: AH00957: HTTPS: attempt to connect to 127.0.0.1:8181 (*) failed
[Tue Apr 18 16:58:56.556722 2017] [proxy_http:error] [pid 31966] [client 93.182.244.38:60339] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: https://gitlab.mydomain.com/users/sign_in

这是使用的虚拟主机:

<VirtualHost *:443>
  ServerName gitlab.mydomain.com
  ServerSignature Off
  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem

  ProxyPreserveHost On

  # Ensure that encoded slashes are not decoded but left in their encoded state.
  # http://doc.gitlab.com/ce/api/projects.html#get-single-project
  AllowEncodedSlashes NoDecode

  <Location />
    # New authorization commands for apache 2.4 and up
    # http://httpd.apache.org/docs/2.4/upgrading.html#access
    Require all granted

    #Allow forwarding to gitlab-workhorse
    ProxyPassReverse https://127.0.0.1:8181
    ProxyPassReverse https://gitlab.mydomain.com/
  </Location>

  # Apache equivalent of nginx try files
  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
  RewriteEngine on

  #Forward all requests to gitlab-workhorse
  RewriteRule .* https://127.0.0.1:8181%{REQUEST_URI} [P,QSA]

  # needed for downloading attachments
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
  ErrorDocument 404 /404.html
  ErrorDocument 422 /422.html
  ErrorDocument 500 /500.html
  ErrorDocument 503 /deploy.html

  # It is assumed that the log directory is in /var/log/httpd.
  # For Debian distributions you might want to change this to
  # /var/log/apache2.
  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  ErrorLog ${APACHE_LOG_DIR}/gitlab_error.log
  CustomLog ${APACHE_LOG_DIR}/gitlab_forwarded.log common_forwarded
  CustomLog ${APACHE_LOG_DIR}/gitlab_access.log combined env=!dontlog
  CustomLog ${APACHE_LOG_DIR}/gitlab.log combined
</VirtualHost>

我做错了什么?

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

gitlab-workhorse doesn't support SSL connections

  

Workhorse可以处理一些请求而不涉及Rails:   例如,Javascript文件和CSS文件是直接提供的   来自磁盘。

     

Workhorse可以修改Rails发送的响应:例如,如果您使用   在Rails中send_file然后gitlab-workhorse将打开文件   磁盘并将其内容作为响应主体发送给客户端。

     

主持人可以在获得Rails的许可后接管请求。   示例:处理git clone。

     

Workhorse可以在将请求传递给Rails之前修改请求。例:   处理Git LFS上传时,Workhorse首先要求获得许可   Rails,然后它将请求体存储在临时文件中,然后发送   包含Rails临时文件路径的修改后的请求。

     

Workhorse可以管理Rails的长期WebSocket连接。   示例:处理环境的终端websocket。

     

Workhorse不会连接到Postgres,只能连接到Rails和(可选)Redis。

     

我们假设所有到达Workhorse的请求都会通过   上游代理,例如NGINX或Apache。

     

主力不接受HTTPS连接。

     

Workhorse不会清理空闲的客户端连接。

     

我们假设所有对Rails的请求都通过Workhorse。