使用apache2(或nginx + apache2)配置gitlab [英] Configure gitlab with apache2 (or nginx + apache2)

查看:120
本文介绍了使用apache2(或nginx + apache2)配置gitlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have installed GitLab in a Ubuntu14.04 server with LAMP. I am aware that GitLab has been designed to work with nginx based servers, but this server has web apps that have been installed over apache2 and I need them.

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

I tried installing GitLab following this tutorial. I used the gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb package.

我最终遇到了和一些发表评论的人相同的问题(错误502).我尝试了以下此内容通过评论链接以查看我是否可以找到任何相关信息,但这似乎与我的情况无关.

I ended up having the same problem than some of the people who commented (error 502). I tried following this link through the comments to see if I could find any relevant information, but it doesn't seem to be relevant for my case.

我一直在寻找通过apache2配置nginx的替代方法,但是我什么都没找到.

I keep searching for alternative ways to configure nginx through apache2, but I'm not finding anything.

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

Here's a log entry that I found in /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"

似乎是上游套接字的配置有问题.

It seems that it is a problem with upstream socket's configuration.

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混淆的可能性).

Anyways, it seems that Omnibus doesn't install nginx at all (or I guess so, there's no service named 'nginx' in /etc/init.d/. I do not discard the possibility that the log generator confused apache2 with nginx).

问题:

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

  • Is it mandatory to install nginx to run gitlab? If so, can it co-exist with apache properly?

通过apache代理GitLab是我要寻找的一种好方法吗?

Is proxying GitLab through apache a good approach to what I'm looking for?

我对独角兽一无所知.我在SO中找到了这个问题.这是否意味着Unicorn在GitLab中处理上游套接字?

I don't know much about Unicorn. I found this question in SO. Does this mean that Unicorn handles upstream sockets in GitLab?

编辑:检查

Checking this document I decided to check if Omnibus installed Ruby with ruby -v and I noticed that Ruby wasn't installed at all. So I decided to compile and install it, following the document's instructions:

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时,发生以下错误:

Anyways, it seems some dependencies failed and ruby is not plently operative. When I try sudo gem install bundler --no-ri --no-rdoc, the following errors ocurr:

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操作期间,发生了以下错误:

During the make operation, these errors happened:

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

It seems that compiling and installing Ruby was completely inneccessary. Looking around for config files, I saw that Omnibus installed lots of dependencies (Ruby among them) in /opt/gitlab/embedded/ directory. :-S

推荐答案

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

Is it mandatory to install nginx to run gitlab? If so, can it co-exist with apache properly?

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

Gitlab is bundled with nginx but you can use it with Apache HTTP server.

通过apache代理GitLab是解决我所寻找问题的一种好方法 为?

Is proxying GitLab through apache a good approach to what I'm looking for?

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

You can disable nginx in Gitlab config and configure Apache to forward to Gitlab.

我对独角兽一无所知.我在SO中发现了这个问题.做 这意味着Unicorn可以在GitLab中处理上游套接字?

I don't know much about Unicorn. I found this question in SO. Does this mean that Unicorn handles upstream sockets in GitLab?

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

Unicorn is HTTP server for Ruby. You can forward requests to Gitlab Unicorn server or gitlab-workhorse.

以下是与Apache一起使用的基本/etc/gitlab/gitlab.rb配置,注释了其他行:

Below is the basic /etc/gitlab/gitlab.rb configuration used with Apache, other lines are commented:

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"

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

unicorn ['listen'] ='127.0.0.1'
unicorn ['port'] = 9099

unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 9099

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

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

nginx ['enable'] = false

nginx['enable'] = false

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

And make proxyPass in /etc/apache2/apache2.conf to the gitlab-workhorse running on 9191:

ProxyPass/gitlab http://127.0.0.1:9191/gitlab
RequestHeader添加X-Forwarded-Proto"https"
RequestHeader在

ProxyPass /gitlab http://127.0.0.1:9191/gitlab
RequestHeader add X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Ssl on

这篇关于使用apache2(或nginx + apache2)配置gitlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆