【问题标题】:Configure gitlab with apache2 (or nginx + apache2)使用 apache2(或 nginx + apache2)配置 gitlab
【发布时间】:2015-03-30 08:52:09
【问题描述】:

我已经在带有 LAMP 的 Ubuntu14.04 服务器上安装了 GitLab。我知道 GitLab 旨在与基于 nginx 的服务器一起使用,但该服务器具有已通过 apache2 安装的 Web 应用程序,我需要它们。

我尝试在this tutorial 之后安装 GitLab。我使用了 gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb 包。

我最终遇到了与评论中的一些人相同的问题(错误 502)。我尝试通过 cmets 关注 this link 以查看是否可以找到任何相关信息,但这似乎与我的情况无关。

我一直在寻找通过 apache2 配置 nginx 的替代方法,但我没有找到任何东西。

这是我在/var/log/gitlab/nginx/gitlab_error.log 中找到的日志条目:

2015/01/30 19:32:27 [error] 995#0: *3 connect() to unix:/var/opt/gitlab
/gitlab-rails/sockets/gitlab.socket failed (111: Connection refused)
while connecting to upstream, client: 127.0.0.1, server: mygitlab.com,
request: "GET / HTTP/1.1", upstream: "http://unix:/var/opt/gitlab/gitlab-
rails/sockets/gitlab.socket:/", host: "localhost:8080"

看来是上游socket的配置有问题。

gitlab-ctl status 输出:

run: logrotate: (pid 4465) 1488s; run: log: (pid 826) 5087s
run: nginx: (pid 837) 5087s; run: log: (pid 825) 5087s
run: postgresql: (pid 827) 5087s; run: log: (pid 817) 5087s
run: redis: (pid 828) 5087s; run: log: (pid 818) 5087s
run: sidekiq: (pid 839) 5087s; run: log: (pid 824) 5087s
run: unicorn: (pid 5861) 0s; run: log: (pid 823) 5087s

无论如何,Omnibus 似乎根本没有安装 nginx(或者我猜是这样,/etc/init.d/ 中没有名为“nginx”的服务。我不排除日志生成器将 apache2 与 nginx 混淆的可能性)。

问题:

  • 是不是必须安装nginx才能运行gitlab?如果可以,能不能和apache正常共存?

  • 通过 apache 代理 GitLab 是我正在寻找的一个好方法吗?

  • 我对独角兽了解不多。我在 SO 中找到了this question。这是否意味着 Unicorn 在 GitLab 中处理上游套接字?

编辑:检查this document 我决定检查Omnibus 是否使用ruby -v 安装了Ruby,我注意到根本没有安装Ruby。所以我决定按照文档的说明编译和安装它:

mkdir /tmp/ruby && cd /tmp/ruby
curl -L --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xz
cd ruby-2.1.5
./configure --disable-install-rdoc
make
sudo make install

无论如何,似乎某些依赖项失败了,并且 ruby​​ 无法正常运行。当我尝试sudo gem install bundler --no-ri --no-rdoc 时,出现以下错误:

ERROR:  Loading command: install (LoadError)
    cannot load such file -- zlib
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

make 操作期间,发生了以下错误:

Failed to configure -test-/win32/dln. It will not be installed.
Failed to configure -test-/win32/dln/empty. It will not be installed.
Failed to configure -test-/win32/fd_setsize. It will not be installed.
Failed to configure dbm. It will not be installed.
Failed to configure fiddle. It will not be installed.
Failed to configure gdbm. It will not be installed.
Failed to configure openssl. It will not be installed.
Failed to configure readline. It will not be installed.
Failed to configure tk. It will not be installed.
Failed to configure tk/tkutil. It will not be installed.
Failed to configure win32. It will not be installed.
Failed to configure win32ole. It will not be installed.
Failed to configure zlib. It will not be installed.

EDIT2:似乎编译和安装 Ruby 完全没有必要。四处寻找配置文件,我看到 Omnibus 在/opt/gitlab/embedded/ 目录中安装了许多依赖项(其中包括 Ruby)。 :-S

【问题讨论】:

    标签: ruby apache2 gitlab


    【解决方案1】:

    是不是必须安装nginx才能运行gitlab?如果可以,是否可以共存 正确使用 apache?

    Gitlab 与 nginx 捆绑在一起,但您可以将它与 Apache HTTP 服务器一起使用。

    通过 apache 代理 GitLab 是我正在寻找的一个好方法吗 为了?

    您可以在 Gitlab 配置中禁用 nginx,并将 Apache 配置为转发到 Gitlab。

    我对独角兽了解不多。我在 SO 中发现了这个问题。做 这意味着 Unicorn 在 GitLab 中处理上游套接字?

    Unicorn 是 Ruby 的 HTTP 服务器。您可以将请求转发到 Gitlab Unicorn 服务器或 gitlab-workhorse。

    下面是Apache使用的基本/etc/gitlab/gitlab.rb配置,其他行注释:

    external_url 'https://my.example.com/gitlab'

    gitlab_workhorse['enable'] = true
    gitlab_workhorse['listen_network'] = "tcp"
    gitlab_workhorse['listen_addr'] = "127.0.0.1:9191"

    独角兽['listen'] = '127.0.0.1'
    独角兽['端口'] = 9099

    web_server['external_users'] = ['www-data']
    web_server['username'] = 'apache' #'gitlab-www'
    web_server['group'] = 'apache' #'gitlab-www'

    nginx['启用'] = false

    并将/etc/apache2/apache2.conf 中的proxyPass 设置为在9191 上运行的gitlab-workhorse:

    ProxyPass /gitlab http://127.0.0.1:9191/gitlab
    RequestHeader 添加 X-Forwarded-Proto "https"
    RequestHeader 设置 X-Forwarded-Ssl on

    【讨论】:

      猜你喜欢
      • 2015-11-07
      • 1970-01-01
      • 1970-01-01
      • 2013-10-03
      • 1970-01-01
      • 2018-05-30
      • 2014-10-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多