使用apache2(或nginx + apache2)配置gitlab

我已经在带有LAMP的Ubuntu14.04服务器中安装了GitLab。 我知道GitLab已经设计用于基于nginx的服务器,但是这个服务器的网络应用程序已经安装在apache2上,我需要它们。

我尝试按照本教程安装GitLab。 我使用了gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb包。

我最终遇到的问题与一些评论的人有关(错误502)。 我尝试通过评论关注此链接 ,看看我是否能找到任何相关信息,但它似乎与我的案例无关。

我一直在寻找通过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" 

似乎上游套接字配置存在问题。

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是一个很好的方法来寻找我正在寻找的东西吗?

  • 我对Unicorn了解不多。 我在SO中找到了这个问题 。 这是否意味着Unicorn处理GitLab中的上游套接字?

编辑:检查此文档我决定检查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. 

编辑2 似乎编译和安装Ruby是完全不必要的 。 查看配置文件,我看到Omnibus在/opt/gitlab/embedded/目录中安装了许多依赖项(其中包含Ruby)。 :-S

是否必须安装nginx才能运行gitlab? 如果是这样,它可以与apache正确共存吗?

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

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

你可以在Gitlab配置中禁用nginx并配置Apache转发到Gitlab。

我对Unicorn了解不多。 我在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′
独角兽[‘port’] = 9099

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

nginx [‘enable’] = 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