编辑:

编辑:

我在 Arch 机器上使用 nginx 作为 Web 服务器设置了一个 Gitlab 实例。我执行的步骤如下建筑维基。目前,除了每个项目页面上的下载 archive.zip 按钮外,其他一切都正常:每当我单击该按钮时,我都会陷入无限重定向循环。我没有使用 https 或任何通过开箱即用安装的非标准内容,并且似乎没有任何日志为我提供有用的故障排除方法。

production.log 重复:

Started GET "/tdubois/Wafer-CPC/repository/archive.zip" for 131.170.94.23 at 2015-09-02 14:11:31 +1000
Processing by Projects::RepositoriesController#archive as ZIP
Parameters: {"namespace_id"=>"tdubois", "project_id"=>"Wafer-CPC"}
Redirected to http://domain.edu.au/tdubois/Wafer-CPC/repository/archive.zip
Completed 302 Found in 5020ms (ActiveRecord: 2.0ms)

sidekiq.log重复:

2015-09-02T04:11:31.059Z 31495 TID-1n7fko RepositoryArchiveWorker JID-60d166f32ebd28ba6c591547 INFO: start
2015-09-02T04:11:31.064Z 31495 TID-1n7fko RepositoryArchiveWorker JID-60d166f32ebd28ba6c591547 INFO: done: 0.005 sec

nginx 访问日志重复:

131.170.94.23 - - [02/Sep/2015:14:09:26 +1000] "GET /tdubois/Wafer-CPC/repository/archive.zip HTTP/1.1" 302 150 "http://domain.edu.au/tdubois/Wafer-CPC" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"

您对这里发生的事情有什么想法吗?我不太确定哪个配置文件导致了重定向,所以我将我的 ngnix 文件放在了下面,但如果您认为这是某个 gitlab 文件中的问题,我会在编辑中发布它。谢谢!

nginx.conf:

worker_processes  1;

events {
     worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    include sites-enabled/*;
}

已启用站点/gitlab:

upstream gitlab {
  server unix:/usr/share/webapps/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
}

server {
  listen 0.0.0.0:80;
  listen [::]:80;
  server_name domain.edu.au; 
  server_tokens off; ## Don't show the nginx version number, a security best practice
  root /usr/share/webapps/gitlab/public;

  client_max_body_size 20m;

  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location / {
    ## Serve static files from defined root folder.
    ## @gitlab is a named location for the upstream fallback, see below.
    try_files $uri $uri/index.html $uri.html @gitlab;
  }

  ## We route uploads through GitLab to prevent XSS and enforce access control.
  location /uploads/ {
    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;

    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_set_header    X-Frame-Options     SAMEORIGIN;

    proxy_pass http://localhost:8080;
  }

  ## If a file, which is not found in the root folder is requested,
  ## then the proxy passes the request to the upsteam (gitlab unicorn).
  location @gitlab {
    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;

    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_set_header    X-Frame-Options     SAMEORIGIN;

    proxy_pass http://localhost:8080;
  }

  location ~ ^/(assets)/ {
    root /usr/share/webapps/gitlab/public;
    gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  }

  error_page 502 /502.html;
}

编辑:

正如 Mike 的评论:Sidekiq 由 systemd 启动,完整脚本可见这里。启动命令为:

/usr/bin/bundle exec "sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -q archive_repo -e production -L /var/log/gitlab/sidekiq.log >> /var/log/gitlab/sidekiq.log 2>&1"

不过我不确定这里的队列名称应该是什么。以下是当前版本信息:

System information
System:
Current User:   gitlab
Using RVM:      no
Ruby Version:   2.2.3p173
Gem Version:    2.4.5.1
Bundler Version:1.10.6
Rake Version:   10.4.2
Sidekiq Version:3.3.0

GitLab information
Version:        7.13.5
Revision:       f48c2ee
Directory:      /usr/share/webapps/gitlab
DB Adapter:     mysql2
URL:            http://domain.edu.au
HTTP Clone URL: http://domain.edu.au/some-project.git
SSH Clone URL:  [email protected]:some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        2.6.3
Repositories:   /var/lib/gitlab/repositories/
Hooks:          /usr/share/webapps/gitlab-shell/hooks/
Git:            /usr/bin/git

相关内容