Назад | Перейти на главную страницу

цикл перенаправления gitlab apache

Я пытаюсь настроить gitlab с apache в качестве веб-сервера. До сих пор я не добился успеха. Sidekiq и единорог запускаются нормально, но когда я пытаюсь посетить корневой сайт, меня перенаправляют на / users / login и зацикливаются.

Я использую apache 2.2 и gitlab 6.5.

Моя конфигурация apache:

#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 из одностраничного запроса:

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

Проблема связана с определением вашего обратного прокси. У вас есть петля из-за этого утверждения:

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

Измените свою конфигурацию следующим образом:

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

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