温馨提示×

Debian GitLab如何重启

小樊
42
2026-08-02 10:53:02
栏目: 智能运维

Debian 上重启 GitLab,取决于你是通过 Omnibus 包 还是 源码/容器 安装的。最常见的是 Omnibus GitLab,下面按这个场景说明。


一、Omnibus GitLab(最常见)

1️⃣ 重启 GitLab(推荐)

sudo gitlab-ctl restart

这会重启 所有 GitLab 组件(nginx、puma、sidekiq、postgresql、redis 等)。


2️⃣ 查看运行状态

sudo gitlab-ctl status

3️⃣ 只重启某个服务(可选)

例如只重启 Web 服务:

sudo gitlab-ctl restart nginx

常用服务名:

  • nginx
  • puma(GitLab 主 Web 服务)
  • sidekiq
  • postgresql
  • redis
  • gitaly

4️⃣ 重载配置(修改配置后)

如果你修改了 /etc/gitlab/gitlab.rb

sudo gitlab-ctl reconfigure

⚠️ 注意:reconfigure 会重新生成配置,不等于重启。


二、Docker 方式运行的 GitLab

重启容器

docker restart gitlab

或:

docker ps        # 找到容器名或 ID
docker restart <容器ID>

三、源码安装(较少见)

如果是源码安装:

sudo systemctl restart gitlab

或:

sudo service gitlab restart

四、确认 GitLab 是否真的起来了

curl -I http://localhost

或浏览器访问 GitLab 地址。


五、常见问题

❓ 重启后 502

通常是 pumasidekiq 没起来:

sudo gitlab-ctl status
sudo gitlab-ctl tail puma

❓ 权限问题

确保使用 sudo,否则可能无权限。


如果你愿意,可以告诉我:

  • GitLab 安装方式(Omnibus / Docker / 源码)
  • Debian 版本
  • 报错信息

我可以给你更精确的命令 ✅

0