Question

How do I install Gitlab with Debian7 and Apache

Posted May 16, 2014 19.9k views
I have installed Debian 7 and Gitlab using this tutorial: https://www.digitalocean.com/community/articles/how-to-set-up-gitlab-as-your-very-own-private-github-clone Now I want to use it with my Apache, can anyone tell me how to do?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer
That tutorial uses Nginx for the web server. There's no need to install Apache, but you can do so if you want. First we need to create a new VirtualHost for GitLab. Let's use the file "/etc/apache2/sites-available/gitlab" In it we'll put:


<VirtualHost *:80>
ServerName gitlab.example.com
ServerSignature Off

ProxyPreserveHost On

<Location />
Order deny,allow
Allow from all

ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://gitlab.example.com/
</Location>

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]

# 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
</VirtualHost>


Then enable your site:


a2ensite gitlab
a2enmod proxy_http
a2enmod proxy
service apache2 restart


You should be all set now. If you had previously followed the steps to install nginx, you will probably want to uninstall it. You'll at least need to stop it with service nginx stop

Check out this GitHub repo to see all the details for running GitLab on Apache:

https://github.com/gitlabhq/gitlab-recipes/tree/master/web-server/apache
Submit an Answer