Deploying Gitlab with Apache on Ubuntu 16.04

1) Install dependencies

sudo apt-get install apache2;
sudo apt-get install curl openssh-server ca-certificates postfix

2) Download & Install Gitlab

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

sudo apt-get install gitlab-ce

3) Configure gitlab

sudo gitlab-ctl reconfigure

4) Configure Gitlab to use Apache

sudo vim /etc/gitlab/gitlab.rb

Change "nginx['enable'] = true" to "nginx['enable'] = false"

Change "webserver['externalusers'] = []" to "webserver['externalusers'] = ['www-data']"

Change "gitlabrails['trustedproxies']" to your web servers IP address. e.g. gitlabrails['trustedproxies'] = ['10.128.0.2']

Change "gitlabworkhorse['listennetwork'] = "unix" to gitlabworkhorse['listennetwork'] = "tcp"

Change gitlabworkhorse['listenaddr'] = "/var/opt/gitlab/gitlab-workhorse/socket" to gitlabworkhorse['listenaddr'] = "127.0.0.1:8181"

Change "unicorn['port'] = 8080" to "unicorn['port'] = 8082"

4.5) Update Gitlab ports

Create or edit the file:
vim /etc/default/gitlab
Enter:
gitlab_workhorse_options="-listenUmask 0 -listenNetwork tcp -listenAddr 127.0.0.1:8181 -authBackend http://127.0.0.1:8082"

5) Reload the new Gitlab configuration

sudo gitlab-ctl reconfigure

6) Enable Apache modproxy & modrewrite

sudo a2enmod proxy; sudo a2enmod rewrite; sudo a2enmod proxy_http;

6) Create Apache Config for Gitlab

sudo vim /etc/apache2/sites-available/gitlab.conf

Enable the apache config:
sudo a2ensite gitlab
Restart apache:
sudo service apache2 restart