微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在debian(基于系统)上配置git-http-backend的nginx

我在使用我的Ubuntu 13.04计算机上的Nginx服务器时,无法让git-http-backend工作.以前用Debian 7尝试过,但结果相似.基本上我遵循http://weininger.net/configuration-of-nginx-for-gitweb-and-git-http-backend/但忽略了任何关于gitweb的事情.

我做了以下事情:

使用以下命令安装Nginx,git,git-core和fcgiwrap:

apt-get install git git-core Nginx fcgiwrap

在/var/git/test.git创建了一个裸仓库并将其归为www-data

mkdir -p /var/git/test.git
cd /var/git/test.git
git init --bare
git update-server-info
chown -R www-data:www-data /var/git

用/ etc / Nginx / sites-enabled / default替换

server {
        listen 80;

        server_name localhost;

        location / {
                root /var/git;

                fastcgi_pass unix:/var/run/fcgiwrap.socket;
                fastcgi_param SCRIPT_FILENAME   /usr/lib/git-core/git-http-backend;
                fastcgi_param PATH_INFO         $uri;
                fastcgi_param GIT_PROJECT_ROOT  /var/git;
                fastcgi_param GIT_HTTP_EXPORT_ALL "";
                include /etc/Nginx/fastcgi_params;
        }
}

做的时候

GIT_CURL_VERBOSE=1 git clone http://localhost/test.git

它打印:

Klone nach 'test'...
* Couldn't find host localhost in the .netrc file; using defaults
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /test.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.8.1.2
Host: localhost
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

* The requested URL returned error: 500 Internal Server Error
* Closing connection 0
error: The requested URL returned error: 500 Internal Server Error while accessing http://localhost/test.git/info/refs?service=git-upload-pack
fatal: HTTP request Failed

/var/log/Nginx/error.log不包含此请求的任何条目.我不确定git-http-backend是否写了一个日志文件却找不到.

你知道这个设置有什么问题吗?你知道如何获得有关500错误的更多信息/日志记录吗?

最佳答案
由于您收到500错误

500 Internal Server Error while accessing http://localhost/test.git/info/refs?service=git-upload-pack

尝试在浏览器中访问该地址,同时观看Nginx错误日志.您可以通过以下方式“以交互方式”查看错误日志:

tail -f /var/log/Nginx/error.log

原文地址:https://www.jb51.cc/nginx/435643.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐