Advertisement
Guest User

Untitled

a guest
Jan 21st, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. <VirtualHost *:80>
  2. ServerName localhost
  3. ServerSignature Off
  4.  
  5. ProxyPreserveHost On
  6.  
  7. # Ensure that encoded slashes are not decoded but left in their encoded state.
  8. # http://doc.gitlab.com/ce/api/projects.html#get-single-project
  9. AllowEncodedSlashes NoDecode
  10.  
  11. <Location />
  12. # New authorization commands for apache 2.4 and up
  13. # http://httpd.apache.org/docs/2.4/upgrading.html#access
  14. Require all granted
  15.  
  16. #Allow forwarding to gitlab-workhorse
  17. ProxyPassReverse http://127.0.0.1:8181/gitlab
  18. #Allow forwarding to GitLab Rails app (Unicorn)
  19. ProxyPassReverse http://127.0.0.1:8080/gitlab
  20. ProxyPassReverse http://localhost/gitlab
  21. </Location>
  22.  
  23. # Apache equivalent of nginx try files
  24. # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
  25. # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
  26. RewriteEngine on
  27.  
  28. #Forward these requests to gitlab-workhorse
  29. RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/gitlab-lfs/objects.* [OR]
  30. RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/builds/download.* [OR]
  31. RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/repository/archive.* [OR]
  32. RewriteCond %{REQUEST_URI} ^/api/v3/projects/.*/repository/archive.* [OR]
  33. RewriteCond %{REQUEST_URI} ^/ci/api/v1/builds/[0-9]+/artifacts.* [OR]
  34. RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$
  35. RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
  36.  
  37. #Forward any other requests to GitLab Rails app (Unicorn)
  38. RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
  39. RewriteCond %{REQUEST_URI} ^/uploads
  40. RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA,NE]
  41.  
  42. # needed for downloading attachments
  43. DocumentRoot /home/git/gitlab/public
  44. <Directory /home/git/gitlab/public>
  45. Require all granted
  46. </Directory>
  47.  
  48. #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
  49. ErrorDocument 404 /404.html
  50. ErrorDocument 422 /422.html
  51. ErrorDocument 500 /500.html
  52. ErrorDocument 503 /deploy.html
  53.  
  54. # It is assumed that the log directory is in /var/log/httpd.
  55. # For Debian distributions you might want to change this to
  56. # /var/log/apache2.
  57.  
  58. LogLevel alert rewrite:trace8
  59.  
  60. LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  61. ErrorLog /var/log/apache2/localhost_error.log
  62. CustomLog /var/log/apache2/localhost_forwarded.log common_forwarded
  63. CustomLog /var/log/apache2/localhost_access.log combined env=!dontlog
  64. CustomLog /var/log/apache2/localhost.log combined
  65. </VirtualHost>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement