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 "web_server['external_users'] = []" to "web_server['external_users'] = ['www-data']"

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

Change "gitlab_workhorse['listen_network'] = "unix" to gitlab_workhorse['listen_network'] = "tcp"

Change gitlab_workhorse['listen_addr'] = "/var/opt/gitlab/gitlab-workhorse/socket" to gitlab_workhorse['listen_addr'] = "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 mod_proxy & mod_rewrite

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