2016-12-08 37 views
0

我已经成功地在Ubuntu 14.04上使用https://about.gitlab.com/downloads/#ubuntu1404安装了Gitlab,但我正在努力通过web(https://my.example.com/gitlab)重定向并访问它。使用SSL的Apache2上的Gitlab

我已经修改/etc/gitlab/gitlab.rb到:

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

nginx的[ '启用'] = FALSE

并与sudo gitlab-ctl reconfigure

重新配置如果我去掉:

web_server [ 'external_users'] = [ 'WWW的数据']

我得到:

配方编译错误在 /选择/ gitlab /嵌入/食谱/高速缓存/食谱/ gitlab-EE /食谱/默认

NoMethodError -------------未定义的方法' - ”为零:NilClass

食谱跟踪: --------------- /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:21:in from_file'
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:26:in
from_file'
/opt/gitlab /embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/default.rb:18:in `from_file”

相关文件内容: --------------- ------- /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:

14:#请参阅许可证以了解管理 权限的特定语言和15:#限制根据许可证。 16:#17: 18:Gitlab [:node] = node 19:20:if File.exists?('/etc/gitlab/gitlab.rb')21 >>
Gitlab.from_file('/ etc/gitlab/gitlab.rb ')22:端部23:24: node.consume_attributes(Gitlab.generate_config(节点[' FQDN']))25:

我已尝试加入各种gitlab.conf到/etc/apache2/sites-available/https://my.example.com/gitlab没有重定向到Gitlab登录页面,我从主页上运行的Redmine服务中收到“Page not found”。目前default-ssl.conf使用DocumentRoot /var/www而Gitlab DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public。 Apache2配置为使用SSL。

更新1

我已经做符号链接:

sudo ln -s /opt/gitlab/embedded/service/gitlab-rails/public /var/www/gitlab 

所以现在可以在默认的ssl.conf配置。

​​

不期待Gitlab主页,而

Alias /gitlab "/var/www/gitlab/deploy.html" 

效果很好。什么是Gitlab主页目录? index.html文件在哪里?

更新2

如果我添加

RackBaseURI /gitlab 
RailsBaseURI /gitlab 
<Directory /var/www/gitlab> 
    Allow from all 
    Options -MultiViews 
</Directory> 

我进入https://my.example.com/gitlab/

Web应用程序无法启动

它看起来像捆扎机后得到错误无法找到一颗宝石。也许你没有安装这个应用程序需要的所有宝石。要安装你的宝石,请运行:

捆绑安装

如果没有工作,那么问题可能是由您的应用程序引起的>不同的环境比它应该被下运行。请检查>以下:

Is this app supposed to be run as the www-data user? 
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use. 

--------例外如下:------- 找不到任何来源耙10.5.0(捆扎机:: GemNotFound)

/var/lib/gems/1.9.1/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in block in materialize' /var/lib/gems/1.9.1/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in map!' /var/lib/gems/1.9.1/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in materialize' /var/lib/gems/1.9.1/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in specs' /var/lib/gems/1.9.1/gems/bundler- 1.12.5/lib/bundler/definition.rb:185:specs_for' /var/lib/gems/1.9.1/gems/bundler-1.12.5/lib/bundler/definition.rb:174:in requested_specs'

上面的异常在更新Ruby之后解决了。

更新3

现在,我得到

enter image description here

Alias /gitlab "/var/www/gitlab" 
AllowEncodedSlashes NoDecode 

<Directory /var/www/gitlab> 
     Options Indexes FollowSymLinks MultiViews 
     PassengerAppRoot "/var/www/gitlab" 
     RailsBaseURI /var/www/gitlab 
     AllowOverride None 
     Order allow,deny 
     allow from all 
</Directory> 

如何配置Gitlab和的Apache2得到Gitlab第一页进入https://my.example.com/gitlab什么时候?

回答

0

我有其他服务在8080工作,所以我已经改变了独角兽端口9099 修改Gitlab配置sudo nano /etc/gitlab/gitlab.rb

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

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

nginx['enable'] = false 

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

重新配置的Gitlab:sudo gitlab-ctl reconfigure

修改Apache的配置sudo nano /etc/apache2/apache2.conf有加:

ProxyPass   /gitlab http://127.0.0.1:9099/gitlab 
ProxyPassReverse /gitlab http://127.0.0.1:9099/gitlab 
RequestHeader add X-Forwarded-Proto https 

重装上阵:

sudo service apache2 reload 
+0

相关:http://serverfault.com/questions/822716/gitlab-https-uri-for-repository-cloning-does-not-work-ssl-host-could-not-beve – Justas

2

听起来好像你的Apache配置不是代理到端口8080上的GitLab服务器(独角兽)。在https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server/apache上有示例Apache配置文件。

还有一个很好的文章解释了使用Apache与GitLab Omnibus在http://ryansechrest.com/2015/08/use-apache-instead-of-built-in-nginx-in-gitlab-ce/的步骤。它有一年多了,所以Apache的配置可能有点过时了。使用指南,但替换上面gitlab-recipes链接的Apache配置,它应该工作。

+0

现在我越来越无法在任何来源(Bundler :: GemNotFound)中找到rake-10.5.0。 – Justas

+0

当你得到这个错误时你运行了什么命令?除了Apache配置之外,你还有什么改变?更改Apache配置不会导致GitLab应用程序突然抛出这些错误。 –

+0

我已经解决了这个问题。在浏览器中输入Gitlab URL后,我得到了它,这是因为Ruby版本不正确以及权限不足。现在它转发到/ opt/gitlab/embedded/service/gitlab-rails/public文件夹,我看到“/ gitlab的索引”包含文件而不是Gitlab主页。 – Justas