环境安装

  • 安装nginx git fcgiwrap
  • 需要使用裸仓库

nginx配置如下

  • git设置为一个虚拟目录,访问方式为: http://ip:port/git/repo.git
	server {
        listen 8800 default_server;
        root /home/git;
        index index.html index.htm index.nginx-debian.html;
        server_name _;
        location ~ /git(/.*) {
                #try_files $uri $uri/ =404;
                #autoindex on;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
                fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
                fastcgi_param GIT_HTTP_EXPORT_ALL "";
                fastcgi_param GIT_PROJECT_ROOT    /home/git ;
                fastcgi_param PATH_INFO           $1;
                include       fastcgi_params;
        }
	}