Gitlab 配置问题:: NGINX 独角兽端口冲突 [英] Gitlab Configuration Issues:: NGINX Unicorn Port Conflict

查看:34
本文介绍了Gitlab 配置问题:: NGINX 独角兽端口冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设法在 Linux CentOS 服务器上使用 Apache、Git、PHP、PostGreSQL 和 MySQL.我正在运行 Chef Cookbook 版本.我从 here 获得了 rpm.我想用它来更好、更直观地管理我的 Git 存储库,这似乎是一个不错的选择.但现在我遇到了让它工作的问题.

I have managed to partly setup Gitlab on a Linux CentOS server with Apache, Git, PHP, PostGreSQL and MySQL. I am running the Chef Cookbook version. I got the rpm from here. I wanted to use it to manage my Git repo better and more visually and this seemed to be a good choice. But now I run into issues getting it to work.

为了让它真正工作并更新所有文件,我决定使用 gitlab-ctl reconfigure 重新运行配置.第二次运行确实有效:

Just to make it really work and update all files I decided to rerun the configuration using gitlab-ctl reconfigure. Second run did work:

Chef Client finished, 4 resources updated
gitlab Reconfigured!

查看完整日志

主办方已经将 NGINX 放在 8080 上,而不是与运行在端口 80 上的 Apache 争论,我们有一个 LAMP 项目正在运行.但是现在 Ruby 的 Unicorn Web Server 似乎和 NGINX 发生了冲突.我曾与 NGINX 合作过一点点,不多,这是我在 Gitlab 的第一次尝试.无论如何,这是我在主人的帮助下想出来的.

The hoster had already put NGINX on 8080 not get into an argument with Apache running on port 80 where we have a LAMP project running. But now Ruby's Unicorn Web Server seems to be conflicting with NGINX. I have worked with NGINX a little bit, not much and this is my first stab at Gitlab. Anyways this is what I figured out with the help of my hoster.

当我登录 testserver.domain.net 并通过以下命令时:

When I log into testserver.domain.net and pass the following command:

netstat -ln |grep 8080 我明白了

tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      

所以有些东西在 8080 上运行根据我的主持人的说法,它应该在 0.0.0.0:8080 上运行.当我们检查该端口上正在运行的内容时,我们会看到

So something is running on 8080 According to my hoster it should run on 0.0.0.0:8080. And when we check what is running on that port we see

netstat -tupln |grep 8080
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      21627/unicorn maste 

当我们检查进程 id 21627 时,我们看到

When we check the process id 21627, we see

cat /proc/21627/cmdline 
unicorn master -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru

这是一个 Ruby 进程,而不是 NGINX 进程.

That is a Ruby process, and not a NGINX process.

所以NGINX似乎和Unicorn发生了冲突.

So NGINX seems to be conflicting with Unicorn.

当我们检查 nginx 的日志时,我们看到 nginx 无法正常运行:

And when we check the logs of nginx we see that nginx cannot get going because of this:

tail -f /var/log/gitlab/nginx/error.log 
2014/07/28 09:43:10 [emerg] 23122#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:10 [emerg] 23122#0: still could not bind()
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: still could not bind()

我搜索了 Unicorn.rb 并找到了这个 链接.我还读到:

I googled Unicorn.rb and found this link. I also read that:

Unicorn 是用于 Rack 应用程序的 HTTP 服务器,旨在仅提供服务低延迟、高带宽连接上的快速客户端,并采取Unix/类 Unix 内核中的功能优势.慢客户端应该只能通过放置能够完全缓冲的反向代理来提供服务Unicorn 和慢速客户端之间的请求和响应.

Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. Slow clients should only be served by placing a reverse proxy capable of fully buffering both the the request and response in between Unicorn and slow clients.

当我检查文件 /var/opt/gitlab/gitlab-rails/etc/unicorn.rb 时,我确实看到它使用 8080.问题是 Unicorn 似乎应该与 NGINX 一起使用,所以也许我不应该更改端口.

When I check the file /var/opt/gitlab/gitlab-rails/etc/unicorn.rb I do see it uses 8080. Issue is that it seems Unicorn should work together with NGINX so perhaps I should not change the port.

我应该采取什么步骤才能使 Gitlab 正常工作?Gitlab 可以在没有独角兽的情况下工作吗?我认为不会.然后我应该为它选择另一个端口还是为 NGINX 选择另一个端口?

What step should I take to make Gitlab work? Can Gitlab work without Unicorn? I would think not. Should I then pick another port for it or perhaps for NGINX?

推荐答案

您应该覆盖 /etc/gitlab/gitlab.rb 中的端口.不要乱用 /var/opt/gitlab/... 因为任何手动配置在重新配置后都会丢失.特别阅读 设置 NGINX 监听端口.在下载页面中有一句话:有关故障排除和配置选项,请参阅 Omnibus GitLab 自述文件.我想知道这是否被人们看不到:/如果没有,我们应该更清楚地说明.

You should override the ports in /etc/gitlab/gitlab.rb. Don't mess with /var/opt/gitlab/... because any manual configuration will be lost after a reconfigure. In particular read on Setting the NGINX listen port. In the downloads page there is a sentence: For troubleshooting and configuration options please see the Omnibus GitLab readme. I wonder if this is not seen by people :/ If not we should make it more clear.

这篇关于Gitlab 配置问题:: NGINX 独角兽端口冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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