A simple static Gopher server in OCaml
8d1bcde9 — Luxferre 2 months ago
Initial upload


browse  log 



You can also use your local clone with git send-email.

#OSmol: the simplest static Gopher server in OCaml

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.


Run ./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 index.map.

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 &


  • No CGI or search selectors support (by design).
  • No Gopher+ selector support (by design).
  • No directory autoindexing (all maps must be created with other tools or by hand).
  • No SSL/TLS support (use Traefik or other reverse proxy to enable it).


Created by Luxferre in 2023, released into public domain.

Made in Ukraine.