• Welcome to LiuJason's Blog!

GitLab网页500/502/503错误--Nginx无法启动问题排查

Linux笔记 Jason 4 years ago (2019-11-24) 1730 Views 1 Comments QR code of this page

让小汤装个GitLab,折腾了一周了还没弄好,网站一直是50x错误,看了下情况是nginx服务挂了。这里记录一下排查的步骤。
首先看看gitlab服务的情况:

gitlab-ctl status
。。。。
run: logrotate: (pid 19388) 838s; run: log: (pid 1746) 2102s
finish: mailroom: (pid 30439) 5s; run: log: (pid 1659) 2132s
down: nginx: 1s, normally up, want up; run: log: (pid 1687) 2120s
run: node-exporter: (pid 19578) 829s; run: log: (pid 1979) 2092s
。。。。

看来是nginx服务down了,试试看手动重启nginx:

gitlab-ctl start nginx && gitlab-ctl status
。。。
run: nginx: (pid 972) 7s; run: log: (pid 971) 7s
。。。

开启成功了,但是网页依旧500错误,再看status发现nginx又挂掉了,说明nginx服务内部出现了问题,继续排查。
看看nginx的日志(完整的日志在这里/var/log/gitlab/nginx/current,但是也可以通过tail看实时的情况):

gitlab-ctl tail nginx
。。。
==> /var/log/gitlab/nginx/current <==
2019-11-24_20:19:12.23865 nginx: [emerg] cannot load certificate "/etc/gitlab/ssl/registry.code.cloudraft.cn.crt": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/gitlab/ssl/registry.code.cloudraft.cn.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file)
。。。

找到问题了,缺了个证书文件,补上就好了。用lsof看看端口监听情况

lsof -i:443
COMMAND  PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   5153       root   10u  IPv4 547257      0t0  TCP *:https (LISTEN)
nginx   5161 gitlab-www   10u  IPv4 547257      0t0  TCP *:https (LISTEN)
nginx   5162 gitlab-www   10u  IPv4 547257      0t0  TCP *:https (LISTEN)
nginx   5163 gitlab-www   10u  IPv4 547257      0t0  TCP *:https (LISTEN)

This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/396.html
Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(1)个小伙伴在吐槽
  1. 这个证书在哪里下载的呢?我也遇到了这个问题
    穿平底鞋的小姑娘2021-02-19 16:16 Reply Windows 10 | Chrome 87.0.4280.66