Skip to content

Instantly share code, notes, and snippets.

@gillesbraun
Created May 5, 2017 08:11
Show Gist options
  • Save gillesbraun/54f7dd4e24c725e772755f3579113dfc to your computer and use it in GitHub Desktop.
Save gillesbraun/54f7dd4e24c725e772755f3579113dfc to your computer and use it in GitHub Desktop.
Gitlab through apache
<Directory /opt/gitlab/embedded/service/gitlab-rails/>
Order allow,deny
ALlow from all
Require all granted
AllowOverride All
</Directory>
<VirtualHost *:80>
DocumentRoot "/opt/gitlab/embedded/service/gitlab-rails/"
ServerName git.example.com
ProxyPreserveHost On
<Location />
Order deny,allow
Allow from all
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://git.example.com
</Location>
RewriteEngine on
RewriteCond %{SERVER_NAME} =git.example.com
#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]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment