Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve apache virtual host configuration #50

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions apache/gitlab
Expand Up @@ -8,12 +8,22 @@
#RewriteCond %{SERVER_PORT} ^80$ #RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] #RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]


ProxyPass /uploads !

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added ProxyPass /error ! after this line to fix the display of HTTP errors coming from apache. Without this, apache tries to load its error page from e.g. /error/HTTP_BAD_GATEWAY.html.var but that gets proxied to unicorn, which then shows a 404 instead of the actual error.

ProxyPass /error !
ProxyPass / http://127.0.0.1:3000/ ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/
ProxyPreserveHost On ProxyPreserveHost On


CustomLog /var/log/apache2/gitlab/access.log combined CustomLog /var/log/apache2/gitlab/access.log combined
ErrorLog /var/log/apache2/gitlab/error.log ErrorLog /var/log/apache2/gitlab/error.log

# Modify path to your need (needed for downloading attachments)
DocumentRoot /home/git/gitlab/public

<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost> </VirtualHost>
<VirtualHost *:443> <VirtualHost *:443>
ServerName gitlab.example.com ServerName gitlab.example.com
Expand All @@ -24,10 +34,20 @@
SSLCertificateKeyFile /etc/apache2/ssl/server.key SSLCertificateKeyFile /etc/apache2/ssl/server.key
#SSLCertificateChainFile /etc/apache2/ssl/cacert.pem #SSLCertificateChainFile /etc/apache2/ssl/cacert.pem


ProxyPass /uploads !
ProxyPass /error !
ProxyPass / http://127.0.0.1:3000/ ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/
ProxyPreserveHost On ProxyPreserveHost On


CustomLog /var/log/apache2/gitlab/access.log combined CustomLog /var/log/apache2/gitlab/access.log combined
ErrorLog /var/log/apache2/gitlab/error.log ErrorLog /var/log/apache2/gitlab/error.log

# Modify path to your need (needed for downloading attachments)
DocumentRoot /home/git/gitlab/public

<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost> </VirtualHost>