Setup gitlab-ce 9.0 on a vServer running Ubuntu 14.04 with Plesk 12
Recently, I had some struggle to get a GitLab instance running on my virtual server. Since I have no or minimal knowledge of configuring a server, Plesk seem to help a lot. Nevertheless, there are some differences between installing GitLab on a Plesk server and installing it on a raw apache setup.
Following steps seem to work:
1. Add your (sub-)domain in Plesk
In this example I chose the subdomain git.myVServer.com.
2. Edit apache config
Go to the config directory
cd /etc/apache2/
Add Listen 81 to the ports.conf file
Go to the additional config file of your vhost
cd /var/www/vhosts/system/git.myVServer.com/conf/
Add a vhost.conf with following content
(Adapted from this GitLab repo)
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ServerName http://git.myVServer.com
ServerSignatureOffProxyPreserveHostOnAllowEncodedSlashesNoDecode
<Location \>
Requireall granted
#Allow forwarding to gitlab-workhorse ProxyPassReverse http://127.0.0.1:8081
ProxyPassReverse http://git.myVServer.com:81
</Location>
RewriteEngineon#Forward all requests to gitlab-workhorse except existing files like error documents RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
# needed for downloading attachments DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/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 502 /502.html
ErrorDocument 503 /503.html
# It is assumed that the log directory is in /var/log/httpd. # For Debian distributions you might want to change this to # /var/log/apache2. LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_forwarded.log common_forwarded
CustomLog /var/log/apache2/gitlab_access.log combined env=!dontlog
CustomLog /var/log/apache2/gitlab.log combined