Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the default Gitlab port

Tags:

gitlab

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

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"

in the configuration file /etc/gitlab/gitlab.rb and then updated the configuration with gitlab-ctl reconfigure && gitlab-ctl restart.

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.

In order to fix this behavior, is it necessary to specify the port also somewhere else than in /etc/gitlab/gitlab.rb?

like image 396
ewcz Avatar asked Jul 24 '16 09:07

ewcz


People also ask

Does GitLab reconfigure restart GitLab?

If you manually edit any files in /var/opt/gitlab that are managed by Chef, running reconfigure reverts the changes and restarts the services that depend on those files.

What web server does GitLab use?

GitLab serves web pages and the GitLab API using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses Redis as a non-persistent database backend for job information, meta data, and incoming jobs. We also support deploying GitLab on Kubernetes using our GitLab Helm chart.


1 Answers

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" }

replace port and hostname with your values, then as root or with sudo:

gitlab-ctl reconfigure
gitlab-ctl restart

It helps me on Debian 8.5, gitlab-ce from gitlab repo.

like image 52
Konstantin Šuvakin Avatar answered Nov 07 '22 05:11

Konstantin Šuvakin