cGit Server on a Ubuntu Server running Nginx

From MattWiki
(Redirected from Ubuntu/webserver/git-server)
noteThis Page was written with Ubuntu 16.04 LTS in mind, and may not work correctly with other versions or distributions.


Assuming this is a fresh install, get the system up to date before we start doing anything else.

apt update && apt -y upgrade && reboot

Install needed software

apt -y install git subversion git-svn vim multitail gcc make openssl libssl-dev libpcre3 \
libpcre3-dev htop ntp default-jre markdown python-markdown python-docutils fcgiwrap

Setup the config for fcgiwrap

mkdir -p /etc/sysconfig
echo 'FCGI_SOCKET=/var/run/fcgiwrap.socket
FCGI_PROGRAM=/usr/local/sbin/fcgiwrap
FCGI_USER=nginx
FCGI_GROUP=nginx
FCGI_EXTRA_OPTIONS="-M 0700"
OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM"
' > /etc/sysconfig/spawn-fcgi

Set fcgiwrap to start when the system reboots

update-rc.d fcgiwrap defaults
update-rc.d fcgiwrap enable

Get Ready for Nginx install.

mkdir -p /var/cache/nginx
wget http://wiki.mattrude.com/images/d/d5/Nginx-INIT.gz
gzip -d Nginx-INIT.gz
mv Nginx-INIT /etc/init.d/nginx
/home/matt/bin/web/nginx-update.sh
update-rc.d nginx defaults
update-rc.d nginx enable
service nginx restart