Running apache2 and gitlab with gitlab on alternative HTTP port

Hi,

I am having trouble changing the port of a local instillation of gitlab. There seems to be inconsistencies in gitlab changing it. Its lke there is no one canonical place to define it.

I have tried in /etc/gitlab/gitlab.rb :-

external_url 'http://zzz.org:8080'

And :-

external_url 'http://zzz.org'
external_port '8080'

And :-

external_url 'http://zzz.org:8080'
external_port '8080'

And :-

external_url 'http://zzz.org'
gitlab_rails['gitlab_port'] = 8080

And :-

external_url 'http://zzz.org:8080'
gitlab_rails['gitlab_port'] = 8080

each followed by :-

sudo gitlab-ctl reconfigure

And I am getting a 502 :-

Whoops, GitLab is taking too much time to respond.

The solution that seems to work is :-

external_url 'http://zzz.org'
external_port '8080'
gitlab_rails['gitlab_port'] = 8080

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

otherwise gitlab seems to run on both 80 and 8080 and conflicts with Apache

I do not have the time to look at the code and I don’t really know Ruby, but this does seem to be an inconsistent area.

Regards,

Aaron

This is still not solved as it does not seem to work externally only from localhost !

You can turn off the built-in Nginx entirely and use your Apache server to serve Gitlab.

See here for the Apache configuration examples:

To turn off the built-in Nginx, add this to your config file:

nginx['enable'] = false

Hi,

I am actually using Node.js for serving on ports 80 and 443, but was going via Apache to get LetsEncrypt certs.

Aaron

There’s no need to use Apache in order to set up LetsEncrypt. All you need to do is use the LetsEncrypt webroot authentication method with the Nginx that is already configured for GitLab.

Assuming that you are using the Omnibus default paths, here is an example command you might use for LetsEncrypt that will take advantage of the Nginx root that already exists:

(Note: This was written from memory without testing, so you may need to adjust it a bit.)

letsencrypt-auto certonly -a webroot --webroot-path /opt/gitlab/embedded/service/gitlab-rails/public -d git.yourdomain.com