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

前端之家收集整理的这篇文章主要介绍了在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:

  1. apt-get install git git-core Nginx fcgiwrap

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

  1. mkdir -p /var/git/test.git
  2. cd /var/git/test.git
  3. git init --bare
  4. git update-server-info
  5. chown -R www-data:www-data /var/git

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

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. location / {
  5. root /var/git;
  6. fastcgi_pass unix:/var/run/fcgiwrap.socket;
  7. fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
  8. fastcgi_param PATH_INFO $uri;
  9. fastcgi_param GIT_PROJECT_ROOT /var/git;
  10. fastcgi_param GIT_HTTP_EXPORT_ALL "";
  11. include /etc/Nginx/fastcgi_params;
  12. }
  13. }

做的时候

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

它打印:

  1. Klone nach 'test'...
  2. * Couldn't find host localhost in the .netrc file; using defaults
  3. * About to connect() to localhost port 80 (#0)
  4. * Trying 127.0.0.1...
  5. * Connected to localhost (127.0.0.1) port 80 (#0)
  6. > GET /test.git/info/refs?service=git-upload-pack HTTP/1.1
  7. User-Agent: git/1.8.1.2
  8. Host: localhost
  9. Accept: */*
  10. Accept-Encoding: gzip
  11. Pragma: no-cache
  12. * The requested URL returned error: 500 Internal Server Error
  13. * Closing connection 0
  14. error: The requested URL returned error: 500 Internal Server Error while accessing http://localhost/test.git/info/refs?service=git-upload-pack
  15. fatal: HTTP request Failed

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

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

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

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

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

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

猜你在找的Nginx相关文章