Gitlab with apache2 and multiple websites
This tutorial assumes you have a Ubuntu 14.04 droplet on Digital Ocean with 2GB of RAM. If you use a smaller droplet with 1Gb of RAM, GitLab will run out of memory some times and crash. With a smaller droplet, it will simply not work.
The idea is to first install the Gitlab Omnibus package, install apache and configure gitlab to use the installed apache server instead of its default nginx server.
Gitlab Omnibus Install
First install all dependencies. Choose "Internet Site" during Postfix install. Then install the GitLab Omnibus package:
Modify the GitLab configuration file located on /etc/gitlab/gitlab.rb
:
Then run sudo gitlab-ctl reconfigure
to reboot GitLab with the new settings.
After the last step, GitLab should be working properly. Visit your GitLab URL and login using the username root
and password 5iveL!fe
.
Installing apache2
Install apache2:
If apache doesnt work with the error:
You can try to close other processes using port 80 with the commands:
Another cause for this problem may be two directives in the apache configuration trying to bind to the same port.
This command will show all lines that have the word "listen", including the port numbers. If there is more than one port 80 declaration in this file, remove one of them.
Configuring apache virtual hosts for a new a website
To configure a website domain with apache virtual hosts, duplicate the file /etc/apache2/sites-available/000-default.conf
and rename it to something like example-website.com.conf
. Than change the files configurations:
After creating the virtual host, add it to the enabled-sites and restart apache:
Don't forget to create a virtual host for your gitlab domain.
Configuring gitlab to use apache2
In /etc/gitlab/gitlab.rb
modify:
Create the Virtual Host file for GitLab on /etc/apache2/sites-available/gitlab.conf
with the contents below, modifying the URLs:
Then bind GitLab virtual host to enabled sites and restart apache:
Then run sudo gitlab-ctl reconfigure
to reload GitLab configurations. If you need to restart the server, use the command sudo gitlab-ctl restart
.
If by any chance you have to change the git-data file, its locate in /var/opt/gitlab/git-data
.
Links
- Using a non-bundled web-server - GiLab Help
- Setting up Gitlab on Ubuntu 14.04 with Apache2 without owning a domain name - GitLab Forum
- Host GitLab on Digital Oena - Geek Igor
- Install GitLab on Ubuntu 14.04 using Apache2
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 - Digital Ocean
- Using gitlab's nginx to serve another app - Stack Overflow
About me
Hi, my name is James Peret. I'm a freelance designer, programmer and filmmaker from São Paulo, Brazil. This is my blog about technical stuff.