首页 > 解决方案 > 尝试克隆项目时,带有外部 nginx 的自托管 GitLab 出现 502 错误

问题描述

VPS,清除 Ubuntu 18.04 LTS,2 核,4 GB RAM,25 GB 磁盘;

  1. 安装nginx和Passenger;
  2. 在子域中安装 GitLab;
  3. 禁用 GitLab 内置的 nginx,切换到外部 nginx。

我根据 GitLab 文档做了所有三点。

在 /var/opt/gitlab 上为 git 用户添加授予权限并安装 ruby​​-dev && nodejs。

之后,GitLab 出现在子域中,我定义了管理员密码,一般来说,网页版看起来可以工作。

但我无法从 GitLab 克隆项目,它收到 502 错误:

$ git clone https://git.myserver.com/root/tock.git   Cloning into
'tock'...   remote: GitLab is not responding   fatal: unable to access
'https://git.myserver.com/root/tock.git/': The requested URL returned
error: 502

当我尝试克隆时,以下条目出现在 var/log/gitlab/nginx/gitlab_access.log 的内置 nginx 日志中:

81.30.208.16 - - [03/May/2021:13:51:42 +0300] "GET /root/tock.git/info/refs?service=git-upload-pack HTTP/1.1" 502 24 "-" "git/2.29.2.windows.2"

当我在浏览器中打开 git.myserver.com 页面时,以下条目会出现在 var/log/gitlab/nginx/gitlab_access.log 的内置 nginx 日志中:

81.30.208.16 - - [03/May/2021:13:56:02 +0300] "GET /users/sign_in HTTP/1.1" 200 15487 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"

但是 var/log/nginx/access.log 和 var/log/nginx /error.log 的“正常”(预安装,外部)nginx 的日志是空的。

也许内置的 nginx 没有完全禁用?

标签: ubuntunginxgitlabpassengerself-hosting

解决方案


推荐阅读