Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipeacocks/2bfd279b0955187ea8b01d94ddb7e332 to your computer and use it in GitHub Desktop.
Save ipeacocks/2bfd279b0955187ea8b01d94ddb7e332 to your computer and use it in GitHub Desktop.
gitlab with own nginx

How to setup gitlab without embedded nginx

Install via omnibus-package

install the normal way:

wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.7.2-omnibus.5.4.2.ci-1_amd64.deb & > /dev/null

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install -y vim openssh-server postfix

# When download has finished:
sudo dpkg -i gitlab_7.7.2-omnibus.5.4.2.ci-1_amd64.deb

Edit the /etc/gitlab/gitlab.rb-file. Configure only the following settings:

  • external_url: http://{your-hostname}
  • ci_external_url: http://{your-hostname}:3000

Run gitlab-ctl reconfigure.

Open a browser and open your gitlab and your gitlab-ci-page.

Copy the url-callback from ci webpage

Go to the gitlab page and login with

  • Username: root
  • Password: 5iveL!fe

and create your own password and login again.


Go to Admin-Area -> Applications -> New Application and setup something similar to:

  • Name: gitlab-Ci
  • Redirect URI: {the url that was passed on gitlab-ci page as callbackurl}

You got an application id and a Secret. You have to copy this in your /etc/gitlab/gitlab.rb-file on:

  • gitlab_ci['gitlab_server'] = { "url" => '{gitlab-url}', "app_id" => '{app-id}', "app_secret" => '{app-secret}' }

and uncomment this line and save the document.


Run gitlab-ctl reconfigure again.


Now login on gitlab ci and authorize with oauth.

Change to unbundled nginx

"Everything should work"


Call gitlab-ctl stop


Install nginx

# maybe uninstall existing first: sudo apt-get purge nginx nginx-common nginx-full

sudo apt-get install -y nginx

cp /var/opt/gitlab/nginx/conf/gitlab* /etc/nginx/sites-enabled/

service nginx restart

Open /etc/gitlab/gitlab.rb-file again and set:

  • web_server['external_users'] = ['www-data']
  • nginx['enable'] = false

and call

gitlab-ctl reconfigure
gitlab-ctl start

"Everything should work... again"

With unbundled nginx


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment