GitLab – Set External Web Port Number

gitlab

How do I change gitlab's default port 80 to a custom port number?

There are two approaches I've tried:

Set the port in /etc/gitlab/gitlab.rb

external_port "8888"

Then run reconfigure:

gitlab-ctl reconfigure

Set port in /var/opt/gitlab/gitlab-rails/etc/gitlab.yml

production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: gitlab.blitting.com
    port: 8888
    https: false

Then restart gitlab

gitlab-ctl stop
gitlab-ctl start

With both of these, gitlab continues to run on the default 80 port number.

Best Answer

Chad Carbert answer still applies but just want to add extra for version 7.0.0.

Open "/etc/gitlab/gitlab.rb" in your text editor where currently I have external_url http://127.0.0.1/ or similar to that. I may need to change external_url with dns including port number (eg. 'http://gitlab.com.local:81/') then reconfigure using command "sudo gitlab-ctl reconfigure" Gitlab is now working on port 81.

Step by step:

  1. sudo -e /etc/gitlab/gitlab.rb
  2. Change external_url from yourdomain.com to yourdomain.com:9999
    9999 -> Port you want it to run
  3. sudo gitlab-ctl reconfigure
Related Topic