Setup gitlab with apache on debian

In this post I will show an easy way to setup gitlab 8.2 with apache 2.4 instead of its own nginx webserver on a debian 8 system. All information here is also available in the official documentation.

Install Gitlab

apt-get install curl openssh-server ca-certificates postfix
curl | bash
apt-get install gitlab-ce
gitlab-ctl reconfigure

Edit gitlab config to use apache2 webserver instead of nginx

Edit /etc/gitlab/gitlab.rb:

web_server['enable'] = false
web_server['external_users'] = ['www-data']
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = ""
gitlab-ctl reconfigure

Setup apache2 for gitlab

You can download the proper file for your installation here. If you followed the steps in this howto you should probably choose  gitlab-omnibus-apache24.conf .

Move the file to /etc/apache2/sites-available/gitlab.conf

Replace “YOUR_SERVER_FQDN” with your actual domain name inside the file.

If you don’t have mod_proxy and mod_proxy_httpd installed you need to install them via the following lines:

apt-get install libapache2-mod-proxy-html
apt-get install libxml2-dev

a2enmod proxy proxy_httpd rewrite
a2ensite gitlab
service apache2 reload

Gitlab should now be showing if you visit the url you specified earlier.