Gitweb on FreeBSD with mini_httpd
My aim was to get quickly, and as simple as possible, a web interface to my own git repositories.
This is on my local home network only, and for my personal use only.
In order to keep everything easy under control, I created a new jail for this. Setting up a new jail on a ZFS system consists of just a few steps:
Clone a jail-template from a ZFS snapshot:
zfs clone zroot/jails/releases/13.1RELEASE@p0 zroot/jails/gitwebjail ed /jails/gitwebjail/etc/ssh/sshd_config # change listen address
- add a config for this jail in /etc/jail.conf.
- start the jail with
jail -c gitwebjail.
zroot/jails/releases/13.1RELEASE@p0 stands for the name of a
ZFS snapshot that I made earlier.)
I have never used mini_httpd before, so I took this opportunity to give it a try.
pkg install mini_httpd
I created a small config file for this,
host=localhost port=80 user=git nochroot user=nobody dir=/usr/local/www cgipat=cgi-bin/*
After this I created the webdir:
mkdir -p /usr/local/www/cgi-bin
And put a nice welcome index.html in
Gitweb is part of the git package.
pkg install git
Now, make a symbolic link to the cgi-bin:
cd /usr/local/www/cgi-bin ln -s /usr/local/share/examples/git/gitweb/gitweb.cgi .
Create the default directory for your repo's:
mkdir -p /pub/git
Put a test repo in it:
cp /pub/git mkdir testrepo.git cd testrepo.git git init --bare
And point your web-browser to
You should see your testrepo listed.
If everything is running nice, enable mini_httpd in
And copy all git repositories to
A basis password protection can be setup using a .htpasswd file.
Create a .htpasswd file with:
cd /usr/local/www/cgi-bin mini_httpd-htpasswd -c .htpasswd <username>
After this, mini_httpd will see the .htpasswd file and start basic authentication.
Remember that when you are not using TLS, your password is transferred unencrypted to the web server.
Of course, this is just a very basic set up. There is lots of room for improvement.
nochroot in the mini_httpd.cnf could be
chroot, TLS could be activated, and
Have fun !
Proud member of the 10kb.club and the 250kb.club.
Most recent pages All tags Sitemap RSS RSS of Gophersite