如何在 gitlab 中单独重启 bundle nginx? [英] How can I restart bundle nginx in gitlab separately?

查看:101
本文介绍了如何在 gitlab 中单独重启 bundle nginx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Gitlab CE 版本.我可以在 Gitlab 中找到捆绑的 nginx.但是我找不到单独重启 nginx 的方法.我试过 sudo service nginx restart 但它给出了:

I have installed Gitlab CE version. I can find nginx bundled in Gitlab. However I cannot find a way to restart nginx separately. I have tried sudo service nginx restart but it gives:

* Restarting nginx nginx                                     [fail] 

我已经检查了所有文档,但找不到解决方案.我正在尝试根据此 tutorial 将 vhost 添加到捆绑的 nginx 中.但我停留在了那一步.有没有其他方法可以将 vhost 添加到与 Gitlab 捆绑的 nginx 中?或者如何检查我的 nginx conf 是否工作?

I have checked all the document but cannot find a solution. I am trying to add vhost to the bundled nginx according to this tutorial. But I stuck at that step. Is there other way to add vhost to bundled nginx with Gitlab? Or How can I check whether my nginx conf work?

502 错误我已解决.

502 error I have solved.

我尝试根据这个 doc ,但是在我修改 gitlab.rb 并运行 sudo gitlab-ctl reconfigure 之后,我得到 502 糟糕,GitLab 响应时间过长. 错误.

I try to use NON-bundle nginx according to this doc , But after I modify gitlab.rb and run sudo gitlab-ctl reconfigure , I got 502 Whoops, GitLab is taking too much time to respond. error.

这是我用于 nginx 的 gitlab.conf.

Here is my gitlab.conf for nginx.

upstream gitlab {
  server unix://var/opt/gitlab/gitlab-git-http-server/sockets/gitlab.socket fail_timeout=0;
  #
}

server {
  listen *:80;
  server_name blcu.tk;
  server_tokens off;
  root /opt/gitlab/embedded/service/gitlab-rails/public;

  client_max_body_size 250m;

  access_log  /var/log/gitlab/nginx/gitlab_access.log;
  error_log   /var/log/gitlab/nginx/gitlab_error.log;


# Ensure Passenger uses the bundled Ruby version
passenger_ruby /opt/gitlab/embedded/bin/ruby;

# Correct the $PATH variable to included packaged executables
passenger_env_var PATH "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin";

# Make sure Passenger runs as the correct user and group to
# prevent permission issues
passenger_user git;
passenger_group git;

# Enable Passenger & keep at least one instance running at all times
passenger_enabled on;
passenger_min_instances 1;

location / {
  try_files $uri $uri/index.html $uri.html @gitlab;
}

 location @gitlab {
    # If you use https make sure you disable gzip compression 
    # to be safe against BREACH attack

    proxy_read_timeout 300; # Some requests take more than 30 seconds.
    proxy_connect_timeout 300; # Some requests take more than 30 seconds.
    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-For   $proxy_add_x_forwarded_for;
    proxy_set_header   X-Frame-Options   SAMEORIGIN;

    proxy_pass http://gitlab;
  }
  location ~ ^/(assets)/  {
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    # gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  }


  error_page 502 /502.html;
}

推荐答案

要仅重启 GitLab Omnibus 的一个组件,您可以执行 sudo gitlab-ctl restart <component>.因此,要重启 Nginx:

To restart only one component of GitLab Omnibus you can execute sudo gitlab-ctl restart <component>. Therefore, to restart Nginx:

sudo gitlab-ctl restart nginx

进一步说明,几乎所有 gitlab-ctl 命令都可以使用相同的概念.例如,sudo gitlab-ctl tail 允许您查看所有 GitLab 日志.应用这个概念,sudo gitlab-ctl tail nginx 将只拖尾 Nginx 日志.

As a further note, this same concept is possible with nearly all of the gitlab-ctl commands. For example, sudo gitlab-ctl tail allows you to see all GitLab logs. Applying this concept, sudo gitlab-ctl tail nginx will tail only Nginx logs.

这篇关于如何在 gitlab 中单独重启 bundle nginx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆