CentOS 7 上新建通过HTTPS访问的Git Server

1. 安装Fastcgiwrap

 

yum install fcgi-devel spawn-fcgi

git clone git://github.com/gnosek/fcgiwrap.git

cd fcgiwrap

autoreconf -i

./configure

make

make install

vi /etc/init.d/fcgiwrap

#! /bin/sh
# chkconfig: 2345 55 25
DESC="fcgiwrap daemon"
DEAMON=/usr/bin/spawn-fcgi
PIDFILE=/var/run/spawn-fcgi.pid
FCGI_SOCKET=/var/run/fcgiwrap.socket
FCGI_PROGRAM=/usr/local/sbin/fcgiwrap
FCGI_USER=www
FCGI_GROUP=www
FCGI_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 "$1" 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
  ;;
esac
exit 0

start fcgiwrap

nginx.conf

location ~ /git(/.*) {
    auth_basic "Restricted";
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
    auth_basic_user_file /etc/nginx.passwd;
    include       fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
    fastcgi_param GIT_PROJECT_ROOT    /var/git-repos;
    fastcgi_param GIT_HTTP_EXPORT_ALL true;
    fastcgi_param PATH_INFO           $1;
    fastcgi_param REMOTE_USER $remote_user;

 

cd /var/git-repos
git init --bare my-project.git
htpasswd -c /etc/nginx.passwd user1

restart nginx

git clone https://www.xiaohui.org/git/my-project.git

 

 

 

 

 

 

 

http://qiita.com/egnr-in-6matroom/items/2a052339ee0515b31fdf

发表评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据