So now I’ve done that as well. Decided that I needed a Git server on my VPS – don’t know for what. But there you have it. The best reason for a nerd is “just ’cause I can”.

GitLab comes with nginx as default, but my VPS has Apache 2(.4). So here is a way to install the GitLab community edition on a Linode VPS with Apache 2 and Sentora web hosting control panel.

First follow the instructions on the download page over at GitLab. I used the Ubuntu 14.04, so if you have another server, your milage may vary.

When you’ve done that, don’t do the sudo gitlab-cal reconfigure stuff just yet.

First follow the the instructions in this document regarding Using a non-bundled web-server.

Then you have to do some magic in the vhost settings for the domain or sub-domain you are using.

 ServerSignature Off
 ProxyPreserveHost On
 AllowEncodedSlashes NoDecode
  <Location />
   Require all granted
 RewriteEngine on
 RewriteCond %{REQUEST_URI} ^/api/v3/.* [OR]
 RewriteRule .*{REQUEST_URI} [P,QSA,NE]
 RewriteCond %{REQUEST_URI} ^/uploads/.*
 RewriteRule .*{REQUEST_URI} [P,QSA]
 DocumentRoot /home/git

Remember to change to your own FQDN. You also have to remember to install and enable the following Apache modules;

mod_rewrite, mod_proxy and mod_proxy_http

Now you can do the sudo gitlab-cal reconfigure and go to your new GitLab server.

For my part I had some trouble getting the folder structure right. I ended up with following the structure from this document. And then it all worked like a charm.

I’ve not set up https as of yet, but that will be coming as well.