系统相关
首页 > 系统相关> > 如何在gitlab中单独重启bundle nginx?

如何在gitlab中单独重启bundle nginx?

作者:互联网

我已经安装了Gitlab CE版本.我可以在Gitlab中找到捆绑的nginx.但是我找不到分别重启nginx的方法.我已经尝试过sudo服务nginx重启但它给出了:

* Restarting nginx nginx                                     [fail] 

我检查了所有文件但找不到解决方案.我试图根据这个tutorial将vhost添加到捆绑的nginx中.但我坚持这一步.有没有其他方法将Ghost添加到Gitlab捆绑的nginx?或者我如何检查我的nginx conf是否有效?

编辑:502错误我已经解决了.

我尝试根据这个doc使用NON-bundle nginx,但是在我修改gitlab.rb并运行sudo gitlab-ctl reconfigure之后,我得到了502 Whoops,GitLab花了太多时间来回应.错误.

这是我的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:

sudo gitlab-ctl restart nginx

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

标签:nginx,gitlab,gitlab-omnibus
来源: https://codeday.me/bug/20190927/1822680.html