【问题标题】:NGINX not starting git-http-serverNGINX 没有启动 git-http-server
【发布时间】:2017-06-07 16:49:00
【问题描述】:

我正在使用 git git-http-backend 脚本在 Nginx 后面的 Git 服务器上工作。

目前我有一个乘客服务器,它正在为端口 2222 上的 Rails 应用程序提供服务。 但是,在 /git/ 文件夹后面,我想提供 git 存储库。问题是,Nginx 似乎没有启动脚本。无论我使用套接字文件还是不同的本地主机帖子,我都会收到 502 错误。这显示在 Nginx 错误日志中:

2017/06/07 18:43:03 [error] 2147#0: *3 no live upstreams while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /git/me/repo HTTP/1.1", upstream: "fastcgi://localhost", host: "localhost:2222"

似乎 nginx 没有启动处理 git 文件的进程。

这是我在 nginx 设置中的位置部分:

 location ~ /git(/.*) {
  include fastcgi.conf;
  include       fastcgi_params;
  #fastcgi_pass  127.0.0.1:8888;
  fastcgi_param SCRIPT_FILENAME /Library/Developer/CommandLineTools/usr/libexec/git-core/git-http-backend;
  # export all repositories under GIT_PROJECT_ROOT
  fastcgi_param GIT_HTTP_EXPORT_ALL "";
  fastcgi_param GIT_PROJECT_ROOT /Users/userx/Documents/Projecten/repositories;
  fastcgi_param PATH_INFO           $1;


  fastcgi_keep_conn on;
  fastcgi_connect_timeout 20s; 
  fastcgi_send_timeout 60s; 
  fastcgi_read_timeout 60s;
  #fastcgi_pass 127.0.0.1:9001;
  fastcgi_param REMOTE_USER $remote_user;
  #fastcgi_pass unix:/var/run/fcgi/fcgiwrap.socket;
  fastcgi_pass localhost:9001;

}

我一个人想不通,谁能分享一下他们的想法?

【问题讨论】:

  • 您找到解决方案了吗?我收到一条略有不同的错误消息,但可能是一个相关的问题。 connect() 在连接到上游时失败(111:连接被拒绝),...,上游:“fastcgi://[::1]:9001”,主机:“repo.interdose.com”
  • 不,起初我让它在 Apache 中工作,然后我切换到 Grack。希望对你有所帮助

标签: nginx nginx-location git-http-backend


【解决方案1】:

检查 nginx 是否可以将文件写入包含 git repo 的文件夹中。 Nginx 以www-data:www-data 用户身份运行,因此这些文件可能具有以下文件的权限:

permission owner      group    file
drwxr-xr-x www-data   www-data ./repoA
dr-xrwxr-x some-owner www-data ./repoB
drwxr-xr-x some-owner www-data ./repoError502

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-06
    • 2015-10-06
    • 1970-01-01
    • 2020-06-11
    • 2018-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多