4 **gmid** - dead simple zero configuration gemini server
10 \[**-c** *cert.pem*]
12 \[**-k** *key.pem*]
13 \[**-l** *access.log*]
18 is a very simple and minimal gemini server.
19 It only supports serving static content, and strive to be as simple as
23 will strip any sequence of
27 in the requests made by clients, so it's impossible to serve content
30 directory by mistake, and will also refuse to follow symlink.
36 are used to ensure that
38 dosen't do anything else than read files from the given directory and
39 accept network connections.
41 It should be noted that
43 is very simple in its implementation, and so it may not be appropriate
44 for serving site with lots of users.
45 After all, the code is single threaded and use a single process
46 (multiple requests are handled concurrently thanks to async I/O.)
48 If a user request path is a directory,
52 file inside that directory.
53 If not found, it will return an error 51 (not found) to the user.
55 The options are as follows:
59 > The certificate to use, by default is
64 > The root directory to serve.
66 > won't serve any file that is outside that directory.
70 > Print the usage and exit.
74 > The key for the certificate, by default is
79 > log to the given file instead of the standard error.
83 > Enable execution of CGI scripts inside the given directory (relative
84 > to the document root.) Cannot be provided more than once.
88 When CGI scripts are enabled for a directory, a request for an
89 executable file will execute it and fed its output to the client.
93 To quickly getting started
95 $ # generate a cert and a key
96 $ openssl req -x509 -newkey rsa:4096 -keyout key.pem \
97 -out cert.pem -days 365 -nodes
99 $ cat <<EOF > docs/index.gmi
103 $ gmid -c cert.pem -k key.pem -d docs
105 now you can visit gemini://localhost/ with your preferred gemini
108 To add some CGI scripts, assuming a setup similar to the previous
112 $ cat <<EOF > docs/cgi-bin/hello-world
114 printf "20 text/plain0
117 $ gmid -d docs -x cgi-bin
119 note that the argument to the
125 since it’s relative to the document root.
129 * it doesn't support virtual hosts: the host part of the request URL is
132 * it doesn't fork in the background or anything like that.