我在 Arch Linux 上配置 Gitlab 后出现此错误:
sudo -u gitlab bundle exec rake gitlab:check RAILS_ENV=production
Check GitLab API access: FAILED: Failed to connect to internal API
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u gitlab -H editor /usr/share/webapps/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
unicorn .stderr.log:
INFO -- : Refreshing Gem list
INFO -- : listening on addr=/run/gitlab/gitlab.socket fd=12
INFO -- : worker=0 ready
INFO -- : worker=1 ready
INFO -- : master process ready
INFO -- : worker=2 ready
权限:
srwxrwxrwx 1 gitlab gitlab 0 Jul 20 09:20 gitlab.socket
-rw-r--r-- 1 gitlab gitlab 6 Jul 20 09:20 unicorn.pid
gitlab-shell/config.yml
http+unix: "/run/gitlab/gitlab.socket"
gitlab_url: "http://127.0.0.1:8080"
gitlab/ unicorn .rb
listen "/run/gitlab/gitlab.socket", :backlog => 1024
# listen "127.0.0.1:8080", :tcp_nopush => true
gitlab/gitlab.yml
host: localhost
port: 3000
https: false
nginx 服务器 block
server
{
listen 80;
server_name code.example.com;
charset utf-8;
location /
{
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:3000;
}
server_tokens off;
}
我尝试了很多东西,nginx 显示空白页面或 502 Bad Gateway,gitlab 检查命令显示“无法连接到内部 API”或“错误 500”。
最佳答案
我遇到了同样的问题。 最终解决问题的是更改默认值:
增加 unicorn['worker_processes']
将 unicorn['listen']
从 127.0.0.1
更改为 GitLab 监听的 IP。
关于ruby-on-rails - GitLab API 访问 : Failed to connect to internal API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38475223/