git使用nginx提供http訪問

環境安裝

  • 安裝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;
        }
    }
相關文章
相關標籤/搜索