Installing GitLab on CentOS managed by Plesk UPDATE

This is how I installed GitLab 6.4 on a Plesk 11.5 system running on CentOS 6.5. For those of you who found this post via Google (or any other search engine…) please be aware and skim through the whole post as I tell about some tricks in chronological order. :)

Generally, I followed the guide on It’s probably the best guide I’ve ever followed for installing a system like GitLab that depends on multiple components! It reads great, explains all the steps and most notably doesn’t miss anything – well only if there is no Plesk. :)

First of all, I had to skip the database part as I already had a running version of MySQL on my server. So I just created the necessary database and its users in the Plesk Panel. For the vhost.conf part of the above guide it is important to know that these Apache config files are managed by Plesk and there is a special directory for them – changing /etc/httpd/conf.d/gitlab.conf will not work! Especially not if you’re working on a subdomain. The correct path for subdomains is /var/www/vhosts/system/FQDN/conf instead. There, add (or change) the vhost.conf or vhost_ssl.conf respectively. You will not need the <VirtualHost *:80>, as the content of these files is inserted in the particular section of an automatically generated configuration file.
For me, the content of my vhost.conf is:

ServerName subdomain.domain.tld
ServerSignature Off

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L]

This makes sure that whenever somebody tries to access your subdomain over http he gets redirected to the https version instead. This is a hint from

The content of my vhost_ssl.conf (derived from the official tutorial as linked above):

ServerName subdomain.domain.tld
ServerSignature Off

ProxyPreserveHost On

<Location />
  Order deny,allow
  Allow from all

  ProxyPassReverse https://subdomain.domain.tld/

# this part redirects to the unicorn instance running on localhost
RewriteEngine on
RewriteRule .*{REQUEST_URI} [P,QSA]
# from GitLab 6.5 above you need the following line otherwise you can't login to GitLab:
RequestHeader set X_FORWARDED_PROTO 'https'

# needed for downloading attachments
DocumentRoot /home/git/gitlab/public

#Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 503 /deploy.html

LogFormat "%{X-Forwarded-For}i %l %u %t "%r" %>s %b" common_forwarded
ErrorLog  /var/log/httpd/logs/gitlab.example.com_error.log
CustomLog /var/log/httpd/logs/gitlab.example.com_forwarded.log common_forwarded
CustomLog /var/log/httpd/logs/gitlab.example.com_access.log combined env=!dontlog
CustomLog /var/log/httpd/logs/ combined

Now all you need to do is reconfigure the vhost settings (this is the part where Plesk reads your custom config files and renders it together with its internal configs into a new one) and restart the server:

/usr/local/psa/admin/bin/httpdmng --reconfigure-all
sudo service httpd restart

This is a hint I got from

Still, trying to load GitLab in the browser results in the following:
Proxy Error
„Proxy Error: Error reading from remote server“, phew! How to solve it? Run

bundle exec rake assets:precompile RAILS_ENV=production

I found this solution on and the keyword here is „Precompilation“. As GitLab needs to precompile its resources on first usage, the first request takes a bit longer…to long for Apache and a timeout is fired. With the above command you manually precompile the Web app and everything runs smoothly then. :)

In fact you may already open GitLab in the browser, but there is still one thing left. I tried to open the robots.txt which is loaded from the /public folder as per configuration file (see above). Before I was able to do this, I needed to run a simple

chmod 755 /home/git

Thanks to for pointing this out!

Voilà! GitLab up and running…

[UDPATE 2014-02-23]:
After following the tutorial on updating from GitLab 6.4 to 6.5 I ran into the issue that I could not login via the Web interface. Obviously the user was redirected to an http resource that didn’t get https cookies. Following the advice on the GitLab Issues page adding this line to the vhost_ssl.conf fixed it:

RequestHeader set X_FORWARDED_PROTO 'https'

I changed the file excerpt above.
Besides I realized the Apache restart above was wrong for Plesk that’s why I changed it.

  • dburr

    Hi, just wondering if you have done a Gitlab upgrade on your Centos/Plesk server? I’m currently running 7.3.2 f092e53, and I see that 7.14.0 6efd0bc is the current version. I would like to upgrade. Is there anything special I should do, are there any gotchas, etc.?