commit 1487e11edab233a7c4a84e87d4e2182519c7f1be from: Omar Polo date: Sat Feb 06 19:05:40 2021 UTC drop sample.conf and add something to the README.md commit - 2b92a4477a693e92320edf6bdebf6fae81a73091 commit + 1487e11edab233a7c4a84e87d4e2182519c7f1be blob - 29cc6bc1e06267e0dab8ccaa69b2629723fd56cd blob + 9d595cffabbae1bc6c87dfe6c6d7ad28285fa9cf --- README.md +++ README.md @@ -58,6 +58,50 @@ The only missing piece is UNICODE normalisation of the 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 blob - 281b46d333e904bb9a1abf6e61cff11289718891 (mode 644) blob + /dev/null --- 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 - } -}