Installation Source
wget HTTP://DL.FEDORAPROJECT.ORG/PUB/EPEL/6/X86_64/EPEL-RELEASE-6-8.NOARCH.RPMRPM-UVH Epel-release*rpmyum Install Fcgi-devel spawn-fcgi-y
Compiling and installing Fcgiwrap
git clone git://github.com/gnosek/fcgiwrap.gitcd fcgiwrapautoreconf-i./configuremakemake install
Configuring the Fcgiwrap Boot script
Vim/etc/init.d/fcgiwrap
#! /bin/sh# chkconfig: 2345 55 25desc= "Fcgiwrap daemon" DEAMON=/usr/bin/ spawn-fcgipidfile=/var/run/spawn-fcgi.pidfcgi_socket=/var/run/fcgiwrap.socketfcgi_program=/usr/local/sbin/ fcgiwrapfcgi_user=wwwfcgi_group=wwwfcgi_extra_options= "-m 0770" options= "-u $FCGI _user -g $ fcgi_group -s $FCGI _socket -s $FCGI _extra_options -f 1 -p $PIDFILE -- $FCGI _program "Do_start () { $DEAMON $OPTIONS | | echo -n "$DESC already running"}do_stop () { kill -INT ' cat $PIDFILE ' | | echo -n "$DESC not running"}case "$" in start) echo -n "starting $DESC: $NAME" do_start echo "." ;; stop) echo -n "stopping $DESC: $NAME" do_stop echo "." ;; restart) echo -n "restarting $DESC: $NAME" do_stop do_start echo "." ;; *) echo "usage: $SCRIPTNAME {start|stop|restart}" >&2 exit 3 ;; Esacexit 0
chmod +x fcgiwrapchkconfig Fcgiwrap on
Add Git's fastcgi configuration
Vim/path/to/nginx/conf/fastcgi_params_git
fastcgi_param query_string $query _string;fastcgi_param REQUEST_METHOD $request _method;fastcgi_param content_type $content _type;fastcgi_param content_length $content _length;fastcgi_param script_name $fastcgi _script_name;fastcgi_param request_uri $request _uri;fastcgi_param document_uri $ document_uri;fastcgi_param document_root $document _root;fastcgi_ param server_protocol $server _protocol;fastcgi_param gateway_ interface cgi/1.1;fastcgi_param server_software nginx/$nginx _ Version;fastcgi_param remote_addr $remote _addr;fastcgi_param remote_port $remote _port;fastcgi_param server_addr $server _addr;fastcgi_param server_port $server _port;fastcgi_param server_name $server _name;fastcgi_param remote_user $remote _user;# required if php was built with --enable-force-cgi-redirectfastcgi_ param redirect_status 200;
Add nginx configuration for git server
server { listen 80; server_name mydevserver; access_log / var/log/nginx/dev.access.log; error_log /var/log/nginx/dev.error.log; location / { root /var/repos; } location ~ /git (/.*) { gzip off; root /usr/lib/git-core; fastcgi_pass unix:/var/run/ Fcgiwrap.socket; include fastcgi_params_git; fastcgi_param script_filename /usr/lib/git-core/git-http-backend; fastcgi_param DOCUMENT_ROOT /usr/lib/git-core/; fastcgi_param script_name git-http-backend; fastcgi_param git_http_ export_all ""; fastcgi_param git_project_root /var/repos; fastcgi_param PATH_INFO $1; #fastcgi_param PATH_TRANSLATED $document _root$fastcgi_path_info; }}
Note that the path to Git-http-backend is correct.
CENTOS6 configuration Nginx + fcgiwrap + git