Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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


@zackify

This comment has been minimized.

Copy link

@zackify zackify commented Aug 30, 2015

I love you 🙏 was looking everywhere for how to do this.

@CanRau

This comment has been minimized.

Copy link

@CanRau CanRau commented Aug 25, 2017

thanks! :) 👍 💯 🥇

@danger89

This comment has been minimized.

Copy link

@danger89 danger89 commented Mar 20, 2018

So how about Gitlab pages??

@rachitharoun

This comment has been minimized.

Copy link

@rachitharoun rachitharoun commented Jul 5, 2018

Thanks, thanks

@michelk

This comment has been minimized.

Copy link

@michelk michelk commented Jul 17, 2018

Gitlab pages??

@Incanus3

This comment has been minimized.

Copy link

@Incanus3 Incanus3 commented Mar 5, 2020

Hi folks,
I just spent most of the day finding out how to do this, so I thought I'd share. If you want to regenerate the nginx config files without running the whole cookbook, you can reenable the nginx['enable'] option, run

/opt/gitlab/embedded/bin/chef-client -z -c /opt/gitlab/embedded/cookbooks/solo.rb -o 'recipe[gitlab::config],recipe[gitlab::nginx]'

copy the files from /var/opt/gitlab/nginx/conf/, than disable the option again and run

/opt/gitlab/embedded/bin/chef-client -z -c /opt/gitlab/embedded/cookbooks/solo.rb -o 'recipe[gitlab::config],recipe[gitlab::nginx_disable]'

. NOTE: if you don't want chef to start the embedded nginx service during the first run, you should also set the bootstrap['enable'] option to false beforehand and possibly reenable it afterwards.

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