0

I am trying to set up gitlab with apache as the webserver. Thusfar, I have been unsuccesful. The sidekiq and unicorn start fine, but when I try to visit the root site, I get redirected to /users/login and get in a loop.

I use apache 2.2 and gitlab 6.5.

My apache config:

#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
<VirtualHost *:80>
  ServerName gitlab.martijn.osbournia.com
  ServerSignature Off

  ProxyPreserveHost On

  <Location />
    Order allow,deny
    Allow from all
    ProxyPassReverse http://127.0.0.1:8081
    ProxyPassReverse http://gitlab.martijn.osbournia.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:8081%{REQEST_URI} [P,QSA]

  # needed for downloading attachments
  DocumentRoot /home/gitlab_martijn/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

  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  ErrorLog  /var/log/apache2/gitlab.martijn.osbournia.com_error.log
  CustomLog /var/log/apache2/gitlab.martijn.osbournia.com_forwarded.log common_forwarded
  CustomLog /var/log/apache2/gitlab.martijn.osbournia.com_access.log combined env=!dontlog
  CustomLog /var/log/apache2/gitlab.martijn.osbournia.com.log combined

</VirtualHost>

Gitlab/unicorn production log from a single page request:

Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:00 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:01 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:02 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
Started GET "/" for 77.168.84.58 at 2014-02-17 12:10:02 +0100
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 2ms
2
  • Watch in the config/gitlab.yml if "host" key is set at the right fqdn.
    – DrGkill
    Feb 17, 2014 at 15:55
  • the fqdn is set. Where can I look next? Feb 20, 2014 at 11:50

1 Answer 1

1

The problem comes from your reverse proxy definition. You have a loop because of that satement :

ProxyPassReverse http://gitlab.martijn.osbournia.com/

Modify your configuration like this :

<Proxy balancer://unicornservers>
    BalancerMember http://127.0.0.1:8081
</Proxy>

ProxyPass / balancer://unicornservers/
ProxyPassReverse / balancer://unicornservers/
ProxyPreserveHost on

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .