This is a really small (under 45 SLOC) server for serving static content on the small net, namely Gopher. It was written more like as an exercise on writing simple server applications in OCaml, but actually is powering the author's gopherhole at hoi.st as a single set-and-forget static binary with zero host-side dependencies.
OSmol is expected to be built using the (POSIX-compatible) Makefile supplied in the repo, which, in turn, requires installing musl-gcc and two packages from Opam:
opam install ocaml-option-static ocaml-option-flambda
Of course, if you need other options, you can tweak the Makefile or build OSmol with the toolchain of your choice. The only module dependency here is
unix.cmxa which comes with any OCaml installation.
./osmol --help to see all command-line options. As of now, they are as follows:
-p: the TCP port to listen on. Defaults to 70.
-d: the root directory where your content resides. Defaults to
.(the current working directory).
-i: the name of the file that must be present in all directories you want to make directly accessible. Without this file, the directory selector cannot be opened. Defaults to
The files whose name is customizable with the
-i switch usually follow standard Gophermap format.
You can also run Osmol as a daemon, logging its start and other output (not much at the moment), for example, like this:
nohup ./osmol -d ./content -p 70 </dev/null 2>&1 | logger &
Created by Luxferre in 2023, released into public domain.
Made in Ukraine.