如何在gitlab中分别重新启动bundle nginx? [英] How can I restart bundle nginx in gitlab separately?

查看:314
本文介绍了如何在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] 

我已经检查了所有文档,但是找不到解决方案.我正在尝试根据教程将vhost添加到捆绑的nginx中.但是我坚持了这一步.还有其他方法可以通过Gitlab将vhost添加到捆绑的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错误.

我尝试根据此

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天全站免登陆