Skip to content

Instantly share code, notes, and snippets.

@reyramos
Created February 16, 2015 15:25
Show Gist options
  • Select an option

  • Save reyramos/b1b878e3af7f5e75d270 to your computer and use it in GitHub Desktop.

Select an option

Save reyramos/b1b878e3af7f5e75d270 to your computer and use it in GitHub Desktop.
Git lab config on Apache2.4
#This configuration has been tested on GitLab 6.0.0 and GitLab 6.0.1
#Note this config assumes unicorn is listening on default port 8080.
#Module dependencies
# mod_rewrite
# mod_proxy
# mod_proxy_http
# Put this after the other LoadModule directives
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
<VirtualHost *:80>
ServerName gitlab.dancik.com
ServerSignature Off
ProxyPreserveHost On
# Ensure that encoded slashes are not decoded but left in their encoded state.
# http://doc.gitlab.com/ce/api/projects.html#get-single-project
AllowEncodedSlashes NoDecode
<Location />
# New authorization commands for apache 2.4 and up
# http://httpd.apache.org/docs/2.4/upgrading.html#access
Require all granted
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://gitlab.dancik.com/
</Location>
#apache equivalent of nginx try files
# http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
# http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
# 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 503 /deploy.html
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog /var/log/gitlab/gitlab.dancik.com_error.log
CustomLog /var/log/gitlab/gitlab.dancik.com_forwarded.log common_forwarded
CustomLog /var/log/gitlab/gitlab.dancik.com_access.log combined env=!dontlog
CustomLog /var/log/gitlab/gitlab.dancik.com.log combined
</VirtualHost>
@reyramos
Copy link
Copy Markdown
Author

Tested on GitLab 7.7.2 bd98290
wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.7.2-omnibus.5.4.2.ci-1_amd64.deb
sudo dpkg -i gitlab_7.7.2-omnibus.5.4.2.ci-1_amd64.deb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment