1

I installed GitLab using the Omnibus installer. It is currently working correctly using Nginx (which GitLab is bundled with) running on port 81. I changed from port 80 to port 81 because I have Apache running on port 80. I also have Tomcat installed and running on port 8080, so I changed the Unicorn port to 8081. All of this works correctly. Below are the settings I changed:

/etc/gitlab/gitlab.rb

# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#configuring-the-external-url-for-gitlab
external_url 'http://mysite.example.net:81'

#https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#tcp-ports-for-gitlab-services-are-already-taken
unicorn['port'] = 8081

#https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#storing-git-data-in-an-alternative-directory
git_data_dir "/mnt/tank/gitlab"

/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: mysite.example.net
    port: 81
    https: false

Unfortunately I need GitLab to run on port 80. I have tried several Apache virtual host configurations. The only success I have had is that I can type the URL http://mysite.example.com/gitlab and get a 404 error, but I see that the URL changes to http://mysite.example.com/users/sign_in. The redirect caused the gitlab to be removed but if I put it back in to get the URL http://mysite.example.com/gitlab/users/sign_in I can see the GitLab login page, though it is all jacked up because none of the images are are correct. The configuration I used to achieve these results is below:

/etc/gitlab/gitlab.rb

    # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#configuring-the-external-url-for-gitlab
    external_url 'http://mysite.example.com'

#https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#tcp-ports-for-gitlab-services-are-already-taken
    unicorn['port'] = 8081

    #https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#storing-git-data-in-an-alternative-directory
    git_data_dir "/mnt/tank/gitlab"

    #https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#using-a-non-bundled-web-server
    nginx['enable'] = false
    web_server['external_users'] = ['www-data']

/etc/apache2/apache2.conf

ServerName mysite.example.com

ProxyRequests Off
<Proxy *>
        Order Allow,Deny
        Allow from all
</Proxy>

# transmission
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission

# gitlab
ProxyPass /gitlab http://localhost:8081
ProxyPassReverse /gitlab http://localhost:8081

/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: mysite.example.com
    port: 80
    https: false
1

I had a similar issue, wanting to set up gitlab with apache, but I don't know if my solution is applicable in your case:

I set up the dns record for the subdomain 'gitlab.example.com' to point to the domain 'example.com', and added a virtualhost for the subdomain. This allowed me to have the proxy work for '/' instead of '/gitlab'. Here are my configuration files:

/etc/gitlab/gitlab.rb:

external_url 'http://localhost:81'

The virtualhost (in /etc/apache2/apache2.conf)

<VirtualHost *:80>
    ServerName gitlab.example.com

    ProxyPass /  http://localhost:81
    ProxyPassReverse / http://localhost:81
</VirtualHost>

This way I can use gitlab through 'http://gitlab.example.com'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.