Install GitLab in combination with Apache2 instead of Nginx

GitLab provides a simple but powerful web based interface to your Git repositories a la GitHub, only you can host it on your own cloud server, control access as you see fit, and repo size is limited only by how much storage space your server has

Install & Configure the necessary dependencies

apt-get install curl openssh-server ca-certificates postfix

Select ‘Internet Site’

Press ‘Enter’

Add the GitLab package server and install the package

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

Install Apache2

apt-get install apache2

Enable Apache2 Proxy

a2enmod proxy_http

Change the GitLab config

nano /etc/gitlab/gitlab.rb

Edit this file and find the following lines, uncomment them or add them if not present.

external_url 'http://gitlab.local:8080'
unicorn['worker_timeout'] = 600
unicorn['port'] = 8080
web_server['external_users'] = ['www-data']
nginx['enable'] = false
ci_nginx['enable'] = false

Reconfigure GitLab

gitlab-ctl reconfigure

Restart GitLab

gitlab-ctl restart

Create a new Apache config with the config below

nano /etc/apache2/sites-available/gitlab.conf
# gitlab
<VirtualHost *:80>
ServerName gitlab.local
DocumentRoot /var/opt/gitlab

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

# Custom log file locations
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_access.log combined
</VirtualHost>

Enable the Apache config file

a2ensite gitlab.conf

Restart the Apache server

service apache2 restart

Add gitlab.local to your DNS or hostfile, then browse to http://gitlab.local and login.

Username: root
Password: 5iveL!fe

 

Leave a Reply

Your email address will not be published. Required fields are marked *