I have git-http-backend
serving git repos through an nginx fastcgi proxy. The nginx config looks like:
server {
listen 443 ssl;
server_name git.example.com;
auth_basic "Git Access";
auth_basic_user_file /etc/nginx/.htpasswd_git;
error_log /var/log/nginx-git-error.log;
access_log /var/log/nginx-git-access.log;
client_max_body_size 0;
root /var/git/;
location ~ /git(/.*) {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_PROJECT_ROOT /var/git;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $1;
fastcgi_read_timeout 600;
}
}
From testing, it seems like if there is more than one request at a time, the proxy will fail (with code 504), and some googling seems to confirm my suspicion that git-http-backend
cannot support multiple requests.
How do I set this up so that multiple requests to the git repo can be made at once?
I recently ran into the same situation and quickly found this script on github
It spawns a new git-http-backend instance for every new http request to it. Compile it (needs go language to be installed) via
go build git-http-multi-backend.go
And run it with
./git-http-multi-backend -r /Path/To/Repos
This will make it listen on:80 (port can be changed). You now simply change your nginx config to something like
location ~ /git(/.*) {
proxy_pass http://localhost:80;
}
I do admit, that this is not the most elegant solution, since it should be definitely possible to achieve the same just via fiddling around with the nginx config. The author of the git-http-multi-backend tool even speaks about it but lacks any specific implementation example.
And I just found another solution, which is even more simple than my previous solution with git-http-multi-backend
You need to increase the maximum amount of FCGI_CHILDREN, which can be spawned.
In my case, I edited /etc/init.d/fcgiwrap and set FCGI_CHILDREN to eg 3. Now, I can check out/clone/push 3 repos at once.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.