git 来自 Nginx 的 502 Bad Gateway 用于大型 GitLab fork
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18501406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
502 Bad Gateway from Nginx for large GitLab fork
提问by Nicholas Albion
I'm running GitLab 6.0.0 through Nginx and can fork small repositories, but when I try to fork a large repository (2GB) I see a "502 Bad Gateway" page after about one minute.
我正在通过 Nginx 运行 GitLab 6.0.0 并且可以分叉小型存储库,但是当我尝试分叉大型存储库 (2GB) 时,大约一分钟后我看到“ 502 Bad Gateway”页面。
/var/log/nginx/gitlab_error.log
shows:
/var/log/nginx/gitlab_error.log
显示:
2013/08/29 12:21:33 [error] 25098#0: *221 upstream prematurely closed connection while reading response header from upstream,
client: 12.34.56.78,
server: myserver,
request: "POST /mygroup/myproject/fork HTTP/1.1",
upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket:/mygroup/myproject/fork",
host: "myserver",
referrer: "http://myserver/mygroup/myproject/fork"
回答by VonC
Issue 1527suggests a memory issue (and that memory requirement in mentioned in the doc).
问题 1527表明存在内存问题(以及文档中提到的内存要求)。
It can also be because of an initial timeout:
也可能是因为初始超时:
I found this error would also occur because the unicorn workers would sometimes take 33 seconds to start and they're configured to timeout after 30 seconds.
我发现这个错误也会发生,因为独角兽工人有时需要 33 秒才能启动,并且他们被配置为在 30 秒后超时。
You can modify unicorn config file /home/git/gitlab/config/unicorn.rb
:
您可以修改独角兽配置文件/home/git/gitlab/config/unicorn.rb
:
timeout 300
In your NGiNX config, you can also add:
在你的 NGINX 配置中,你还可以添加:
proxy_connect_timeout 300;
proxy_read_timeout 300;
If you have a /etc/nginx/fastcgi_params
file with your NGiNX, you can add:
如果你/etc/nginx/fastcgi_params
的 NGiNX有一个文件,你可以添加:
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 156 16k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_max_temp_file_size 0
fastcgi_pass unix:/tmp/fpm.sock;
Note that after a 502, and after making the fixes mentioned above, it is a good idea to clear the browser cache before trying again to access gitlab.
请注意,在 502 之后,并在进行上述修复后,最好在再次尝试访问 gitlab 之前清除浏览器缓存。
回答by Bui Hong Quan
I did the same as your guide. But have little bit change on the fastcgi configuration.
我和你的向导一样。但是在 fastcgi 配置上有一点变化。
fastcgi_pass unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
Thank you very much for your guide!
非常感谢您的指导!
TWINQ78
双Q78