我如何在Gitlab上解决502错误?

时间:2015-08-17 13:17:07

标签: ruby-on-rails git nginx gitlab unicorn

所以,我尝试安装Gitlab,我遇到了一些问题。在Installation from source结束时,当我尝试启动所有服务时,出现502错误。我尝试sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production时收到此消息:

Check GitLab API access: FAILED. code: 502
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

经过一番搜索,我认为这是一个独角兽的错误。这就是我在文件日志tail -n 15 /home/git/gitlab/log/unicorn.stderr.log中找到的内容:

F, [2015-08-17T14:08:25.266483 #15125] FATAL -- : error adding listener addr="188.213.26.27":80
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/socket_helper.rb:147:in `initialize': Permission denied - bind(2) for "188.213.26.27" port 80 (Errno::EACCES)

我不知道如何改变它,如果这是真正的问题。如果它可以提供帮助,那就是Nginx日志tail -f /var/log/nginx/gitlab_error.log

    2015/08/16 16:46:24 [error] 14932#0: *33 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/16 17:00:41 [error] 14932#0: *71 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/16 17:01:04 [error] 19194#0: *33 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/16 17:03:01 [error] 19713#0: *33 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/17 12:18:09 [error] 18616#0: *3 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 82.127.11.127, server: gitlab.nova.ovh, request: "GET / HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket:/", host: "gitlab.nova.ovh"
2015/08/17 12:18:26 [error] 18616#0: *6 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET //api/v3/internal/check HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket://api/v3/internal/check", host: "gitlab.nova.ovh"
2015/08/17 13:47:09 [error] 18616#0: *38 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET //api/v3/internal/check HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket://api/v3/internal/check", host: "gitlab.nova.ovh"
2015/08/17 13:48:05 [error] 18616#0: *42 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET //api/v3/internal/check HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket://api/v3/internal/check", host: "gitlab.nova.ovh"

1 个答案:

答案 0 :(得分:2)

Unicorn必须不绑定端口80,否则它将被拒绝(因此出现错误消息)。低于1024的绑定端口需要root权限。 nginx也使用端口80。如果您使用unix套接字或任何高端口(例如8080或8081)与TCP套接字一起使用,则将unicorn配置为根本不监听TCP端口。