如何单独重启gitlab中的bundle nginx?
How can I restart bundle nginx in gitlab separately?
我安装了Gitlab CE版。我可以在 Gitlab 中找到捆绑的 nginx。但是我找不到单独重启 nginx 的方法。我试过 sudo service nginx restart
但它给出了:
* Restarting nginx nginx [fail]
我已经检查了所有文档,但找不到解决方案。我正在尝试根据此 将 vhost 添加到捆绑的 nginx。但是我卡在了那一步。还有其他方法可以将 vhost 添加到与 Gitlab 捆绑的 nginx 中吗?或者我如何检查我的 nginx conf 是否工作?
编辑:502错误我已经解决了。
我尝试根据这个 doc 使用 NON-bundle nginx ,但是在我修改 gitlab.rb
和 运行 sudo gitlab-ctl reconfigure
之后,我得到了 502 Whoops, GitLab is taking too much time to respond.
错误。
这是我的 gitlab.conf
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;
}
我的教程解释了如何将虚拟主机添加到非捆绑的 nginx 服务器,而不是捆绑的服务器。
步骤是:
- 禁用捆绑版本
- 安装一个用 passenger 模块编译的独立 nginx 版本,
- 配置它作为虚拟主机服务 gitlab
- 然后在上面配置其他自定义虚拟主机。
如果sudo service nginx restart
return
* Restarting nginx nginx [fail]
那么你可能用 sudo apt-get install nginx
之类的东西单独安装了 nginx,或者你安装了带有 pushion passenger 模块的重新编译版本,正如我在我的 tuto 中解释的那样?
你真的用的是捆绑版还是你误解了我教程中的这一步?
Please answer these questions in comments then I will edit this answer to write the solution you really need.
要重新启动捆绑的 nginx,请执行 sudo gitlab-ctl restart
要仅重启 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 日志。
我安装了Gitlab CE版。我可以在 Gitlab 中找到捆绑的 nginx。但是我找不到单独重启 nginx 的方法。我试过 sudo service nginx restart
但它给出了:
* Restarting nginx nginx [fail]
我已经检查了所有文档,但找不到解决方案。我正在尝试根据此
编辑:502错误我已经解决了。
我尝试根据这个 doc 使用 NON-bundle nginx ,但是在我修改 gitlab.rb
和 运行 sudo gitlab-ctl reconfigure
之后,我得到了 502 Whoops, GitLab is taking too much time to respond.
错误。
这是我的 gitlab.conf
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;
}
我的教程解释了如何将虚拟主机添加到非捆绑的 nginx 服务器,而不是捆绑的服务器。
步骤是:
- 禁用捆绑版本
- 安装一个用 passenger 模块编译的独立 nginx 版本,
- 配置它作为虚拟主机服务 gitlab
- 然后在上面配置其他自定义虚拟主机。
如果sudo service nginx restart
return
* Restarting nginx nginx [fail]
那么你可能用 sudo apt-get install nginx
之类的东西单独安装了 nginx,或者你安装了带有 pushion passenger 模块的重新编译版本,正如我在我的 tuto 中解释的那样?
你真的用的是捆绑版还是你误解了我教程中的这一步?
Please answer these questions in comments then I will edit this answer to write the solution you really need.
要重新启动捆绑的 nginx,请执行 sudo gitlab-ctl restart
要仅重启 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 日志。