Setting up mandoc man.cgi on MidnightBSD

Mandoc (mdocml) includes a man.cgi(8) script to display man pages.Â Here's a quick and dirty explanation on how to set it up.
* mport install mdocmlÂ
* Files will be installed in /usr/local/www/mdocml/
* Configure apache
* Configure man directory
create a directory /man on your file system. This is the default path.Â
in it, create a file called manpath.conf
it should have a RELATIVE path for one or more directories (per line) that you want to index.Â
so /man/midnightbsd-3.1
copy the man1, man2, and so on folders from /usr/share/man for your release.Â
extract all of then with gunzip
run makewhatis -a . from the /man/midnightbsd-3.1 folder.Â This will create your mandoc.db file.Â
Apache config

Â Â Â Â Protocols h2c http/1.1
Â Â Â Â H2Direct on
Â Â Â Â DocumentRoot /usr/local/www/mdocml/htdocs/
Â Â Â Â ServerName man.midnightbsd.org
Â Â Â Â ErrorLog /var/log/man.midnightbsd.org-error_log
Â Â Â Â CustomLog /var/log/man.midnightbsd.org-access_log combinedio
Â Â Â Â RedirectMatch ^/$ /cgi-bin/man.cgi
Â Â Â Â
Â Â Â Â DirectoryIndex man.cgi index.html
Â Â Â Â Require all granted
Â Â Â Â
Â Â Â Â ScriptAlias /cgi-bin/ "/usr/local/www/mdocml/cgi-bin/"
Â Â Â Â
Â Â Â Â Options +ExecCGI
Â Â Â Â SetHandler cgi-script
Â Â Â Â