HOFFA: httpd, OpenBSD, flat-files, and awk
sqlite
in the base system,
I joked that the
BCHS
web stack would need to drop
sqlite
and investigate new options for a web-stack available purely in the
OpenBSD base system.
So continuing that joke, I proposed the
HOFFA
web stack:
httpd
,
OpenBSD, flat-files, and
awk
.
Server configuration
This walk-through assumes you've managed to follow one of the many fine OpenBSD installation guides and now have a fresh OpenBSD system with no packages installed.
Begin by copying the template
httpd.conf
into the
/etc
directory:
Next, edit
/etc/httpd.conf
and in your
server
block, add a
location
directive to point to your
cgi-bin/
directory (this is relative to your
$CHROOT
so the absolute path ends up being
/var/www/cgi-bin/
by default)
Now with the web server configured, it, and the
slowcgi
proxy need to be enabled.
(the
rcctl check slowcgi
may be optional but it doesn't hurt to confirm that it's running)
Populating binaries & libraries in the
$CHROOT
With the server and CGI proxy running, binaries need to be put where
they'll be found.
As this is
HOFFA
this uses
awk
then create the library directories and copy in the needed libraries.
First, find out which libraries
awk
needs:
so we need to create those library directories in the
$CHROOT
and copy the libraries in
Hello world
Now with the web server &
slowcgi
in place, along with the required binaries & libraries, it's time
to write some code.
With this in place, it should now be possible to point your browser at your newly configured script. If your browser is on the same machine you can visit http://localhost/cgi-bin/example.awk or if it's on a remote machine, use its domain-name or IP address http://example.com/cgi-bin/example.awk