更改默认的Gitlab端口 [英] Changing the default Gitlab port
问题描述
我已通过Omnibus软件包在CentOS 7(全新安装)上安装了最新的Gitlab-CE(8.10),如下所述: https://about.gitlab.com/downloads/#centos7
I have installed the latest Gitlab-CE (8.10) on CentOS 7 (fresh install) via the Omnibus package as described here: https://about.gitlab.com/downloads/#centos7
现在,我想更改可以访问Gitlab Web界面的默认端口.为此,我遵循了 http://docs.gitlab.com/omnibus/settings/nginx.html#change-the-default-port-and-the-ssl-certificate-locations ,即我包括了
Now, I would like to change the default port at which one can access the Gitlab web interface. To this end, I followed the instructions at http://docs.gitlab.com/omnibus/settings/nginx.html#change-the-default-port-and-the-ssl-certificate-locations, namely I included
external_url "http://127.0.0.1:8765"
配置文件/etc/gitlab/gitlab.rb
中的
,然后用gitlab-ctl reconfigure && gitlab-ctl restart
更新配置.
in the configuration file /etc/gitlab/gitlab.rb
and then updated the configuration with gitlab-ctl reconfigure && gitlab-ctl restart
.
但是,当我随后导航到http://127.0.0.1:8765
时,Gitlab会继续重定向到http://127.0.0.1/users/sign_in
,即,以某种方式丢弃了端口规范.然后,当我在浏览器中手动将URL更改为http://127.0.0.1:8765/users/sign_in
时,它会正确显示登录页面,有趣的是,页面上的所有链接(例如"Explore","Help")都包含端口规范.
However, when I then navigate to http://127.0.0.1:8765
, Gitlab keeps redirecting to http://127.0.0.1/users/sign_in
, i.e., the port specification is somehow discarded. When I then manually change the URL in the browser to http://127.0.0.1:8765/users/sign_in
, it correctly displays the login page and interestingly, all links on the page (e.g., "Explore", "Help") contain the port specification.
为了解决此问题,是否有必要在/etc/gitlab/gitlab.rb
之外的其他地方指定端口?
In order to fix this behavior, is it necessary to specify the port also somewhere else than in /etc/gitlab/gitlab.rb
?
推荐答案
问题在这里: https://gitlab.com/gitlab-org/gitlab-ce/issues/20131 解决方法: 将此行添加到/etc/gitlab/gitlab.rb:
Issue here: https://gitlab.com/gitlab-org/gitlab-ce/issues/20131 Workaround: add this line to /etc/gitlab/gitlab.rb:
nginx['proxy_set_headers'] = { "X-Forward-Port" => "8080", "Host" => "<hostname>:8080" }
用您的值替换端口和主机名,然后以root或sudo替换:
replace port and hostname with your values, then as root or with sudo:
gitlab-ctl reconfigure
gitlab-ctl restart
它对我在gitlab repo上的gitlab-ce上的Debian 8.5上有帮助.
It helps me on Debian 8.5, gitlab-ce from gitlab repo.
这篇关于更改默认的Gitlab端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!