From 1487e11edab233a7c4a84e87d4e2182519c7f1be Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Sat, 6 Feb 2021 19:05:40 +0000 Subject: [PATCH] drop sample.conf and add something to the README.md --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ sample.conf | 42 ------------------------------------------ 2 files changed, 44 insertions(+), 42 deletions(-) delete mode 100644 sample.conf diff --git a/README.md b/README.md index 29cc6bc..9d595cf 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,50 @@ The only missing piece is UNICODE normalisation of the IRI path: gmid doesn't do that (yet). +## Configuration + +gmid has a rich configuration file, heavily inspired by OpenBSD' +httpd. While you should definitely check the manpage because it +documents every option in depth, here's an example of what gmid can +do. + +```conf +ipv6 on # enable ipv6 + +server "example.com" { + cert "/path/to/cert.pem" + key "/path/to/key.pem" + root "/var/gemini/example.com" + lang "it" + cgi "/cgi/*" + + location "/files/*" { + auto index on + } + + location "/repo/*" { + # change the index file name + index "README.gmi" + } + + # redirect /cgi/man/... to man.example.com/... + location "/cgi/man*" { + strip 2 + block return 31 "gemini://man.example.com%p" + } +} + +server "man.example.com" { + cert "..." + key "..." + root "/var/gemini/man.example.com" + + # handle every request with the CGI script `man' + entrypoint "man" +} +``` + + ## Building gmid depends on a POSIX libc, OpenSSL/LibreSSL and libtls (provided diff --git a/sample.conf b/sample.conf deleted file mode 100644 index 281b46d..0000000 --- a/sample.conf +++ /dev/null @@ -1,42 +0,0 @@ -ipv6 on # enable ipv6 - -# decomment to allow only TLSv1.3 -#protocols "tlsv1.3" - -# add the mapping for the extension rtf to the MIME application/rtf -mime "application/rtf" "rtf" - -# server block example -server "example.com" { - cert "/path/to/cert.pem" - key "/path/to/key.pem" - root "/var/gemini/example.com" -} - -server "it.example.com" { - cert "/path/to/cert.pem" - key "/path/to/key.pem" - root "/var/gemini/example.com" - - # enable CGI scripts in /cgi-bin/ - cgi "/cgi-bin/*" - - # optional - lang "it" -} - -# a server block with a location -server "foo.com" { - cert "..." - key "..." - root "..." - - location "/it/" { - lang "it" - } - - location "/files" { - lang "en" - auto index on - } -}