Back to blog

gitlab the tyrant

12/09/2015 - Posted in do-it-yourself , internet , knowledge , Software Posted by:

Tags: , , , , ,

I am still working on getting everything up and operational and I am working my way through the lush config landscape of all the applications. One such program that has been bugging me is Gitlab. Everytime I started Gitlab it immediately seized the power and redirected all incoming requests to itself. So no blog, no syncing and no hive up and running. After playing around I found out that it was connected to Gitlab’s bundled version of nginx and sockets that would hog all ports so apache2 would not start.

Finally I came across a Stackoverflow post that presented a solution. The post is quite long and I have not read it fully as it is doing something with recompiling nginx or so and I want to stay with apache2. So here are the important pieces if you want to install Gitlab CE and keep the possibility of running other things on your webserver.

On Debian 8 locate the Gitlab config file in

$ /etc/gitlab/gitlab.rb

There find the following lines and set them accordingly. If you do not use the default user “www-data” for Apache2 you have to adapt your web_server users’ setting:

nginx[‘enable’] = false
# For GitLab CI, use the following:
ci_nginx[‘enable’] = false
web_server[‘external_users’] = [‘www-data’]

Then in your terminal as root enter:

$ gitlab-ctl reconfigure
$ service apache2 restart

Of course you have to have the correct vhost file for your Apache to redirect your incoming request to port 8080 which is the standard port for gitlab. Here is an example of the settings I use:

VHost File

<VirtualHost *:80>

    ServerName git.palladion.it

    ServerAlias git  # this allows short name access within the domain

    DocumentRoot /var/opt/gitlab

    RewriteEngine On

    ProxyRequests Off

    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:8080/

    <Location />

        ProxyPassReverse /

        Require all granted

    </Location>

    # Custom log file locations

    ErrorLog /var/log/apache2/gitlab_error.log

    CustomLog /var/log/apache2/gitlab_access.log combined

</VirtualHost>

After setting all that up you should be fine and be able to run multiple things on your host.

Leave a Reply

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