我已经使用https://about.gitlab.com/downloads/ 中的默认包在 Ubuntu 12.04 上设置了 Gitlab
{编辑以澄清}
我已经设置了 Apache 来代理并运行安装在端口 8888 上的包的 nginx 服务器(或者我认为是这样)。
因为我已经安装了 Apache,所以我必须在 localhost:8888 上运行 nginx。问题是,所有图像(例如头像)现在都来自http://localhost:8888
,并且 Gitlab 提供的所有结帐 URL 也是 localhost - 而不是使用我的域名。
如果我更改/etc/gitlab/gitlab.rb
为使用该 url,则 Gitlab 将停止工作并给出 503。
任何想法如何告诉 Gitlab 向世界展示什么 URL,即使它真的在本地主机上运行?
/etc/gitlab/gitlab.rb
好像:
# Change the external_url to the address your users will type in their browser
external_url 'http://my.local.domain'
redis['port'] = 6379
postgresql['port'] = 2345
unicorn['port'] = 3456
Run Code Online (Sandbox Code Playgroud)
和/opt/gitlab/embedded/conf/nginx.conf
看起来像:
server {
listen localhost:8888;
server_name my.local.domain;
Run Code Online (Sandbox Code Playgroud)
[更新]
如果我没有将 localhost:8888 指定为 external_url,则 nginx 似乎仍在侦听错误的端口。我在/var/log/gitlab/nginx/error.log
2014/08/19 14:29:58 [emerg] 2526#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/08/19 14:29:58 [emerg] 2526#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/08/19 14:29:58 [emerg] 2526#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/08/19 14:29:58 [emerg] 2526#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/08/19 14:29:58 [emerg] 2526#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/08/19 14:29:58 [emerg] 2526#0: still could not bind()
Run Code Online (Sandbox Code Playgroud)
Apache 设置如下所示:
<VirtualHost *:80>
ServerName my.local.domain
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Location />
ProxyPass http://localhost:8888/
ProxyPassReverse http://127.0.0.1:8888
ProxyPassReverse http://my.local.domain
</Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
如果 Gitlab 在 localhost:8888 上侦听,这似乎可以代理一切正常 - 我只需要 Gitlab 开始显示正确的 URL,而不是 localhost:8888。
Far*_*ley 15
我很遗憾没有人对此有明确的答案,它是由许多其他帖子和一些狡猾的 conf 编辑拼凑而成的。我把所有的东西都放在一个地方给你们,为了节省我刚刚浪费的两个小时。
我的设置是我有 apache,它托管了许多站点并托管了 HTTPS,我将其配置为指向 gitlab 的反向代理。所以我希望 gitlab 在电子邮件中生成的 URL 指向 apache 的安全 URL。所以要做到这一点...
在 CentOS 7 上,它位于 /opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb
并更改线路...
external_url nil
Run Code Online (Sandbox Code Playgroud)
到
external_url "http://<yoururl>:81"
Run Code Online (Sandbox Code Playgroud)
您的 nginx 现在将托管在端口 81 上,但是您通过电子邮件发送的 URL 看起来像“http://:81”,而不是您的安全 apache 代理。所以要做到这一点...
在 CentOS 7 上,它位于 /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
并更改线路...
## Web server settings (note: host is the FQDN, do not include http://)
host: <yoururl>
port: 81
https: false
Run Code Online (Sandbox Code Playgroud)
到
## Web server settings (note: host is the FQDN, do not include http://)
host: <yoururl>
port: 443
https: true
Run Code Online (Sandbox Code Playgroud)
然后只需确保 nginx 正常启动,如果需要, gitlab-ctl tail nginx 并查看它吐出的错误。
警告:如果再次运行 gitlab-ctl reconfigure,则需要再次进行此编辑。我搜索了高低,发现没有办法以重新配置很好地处理它的方式来做到这一点。这是某人可以要求 gitlab 添加的功能请求,应该很小。一个可选变量“actual_url”,设置后用于任何生成的 URL。
根据Gitlab 的 github 上的文档:
# Copy the example GitLab config
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
# Make sure to change "localhost" to the fully-qualified domain name of your
# host serving GitLab where necessary
Run Code Online (Sandbox Code Playgroud)
还要确保 Apache 正在发送适当的代理标头。
在这种情况下,nginx 配置无关紧要,因为您使用 Apache 进行代理。只需将其移除或关闭即可。
归档时间: |
|
查看次数: |
29451 次 |
最近记录: |