1 3e4749f7 2020-10-02 op .\" Copyright (c) 2020 Omar Polo <op@omarpolo.com>
3 3e4749f7 2020-10-02 op .\" Permission to use, copy, modify, and distribute this software for any
4 3e4749f7 2020-10-02 op .\" purpose with or without fee is hereby granted, provided that the above
5 3e4749f7 2020-10-02 op .\" copyright notice and this permission notice appear in all copies.
7 3e4749f7 2020-10-02 op .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 3e4749f7 2020-10-02 op .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 3e4749f7 2020-10-02 op .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 3e4749f7 2020-10-02 op .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 3e4749f7 2020-10-02 op .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 3e4749f7 2020-10-02 op .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 3e4749f7 2020-10-02 op .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 3e4749f7 2020-10-02 op .Dd $Mdocdate: October 2 2020$
19 3e4749f7 2020-10-02 op .Nd dead simple gemini server
24 3e4749f7 2020-10-02 op .Op Fl c Ar cert.pem
25 3e4749f7 2020-10-02 op .Op Fl d Ar docs
26 3e4749f7 2020-10-02 op .Op Fl k Ar key.pem
28 3e4749f7 2020-10-02 op .Sh DESCRIPTION
30 3e4749f7 2020-10-02 op is a very simple and minimal gemini server.
31 3e4749f7 2020-10-02 op It only supports serving static content, and strive to be as simple as
35 3e4749f7 2020-10-02 op will strip any sequence of
39 3e4749f7 2020-10-02 op in the requests made by clients, so it's impossible to serve content
42 3e4749f7 2020-10-02 op directory by mistake.
43 6980aad6 2020-10-02 op Furthermore, on
48 3e4749f7 2020-10-02 op are used to ensure that
50 3e4749f7 2020-10-02 op dosen't do anything else than read files from the given directory and
51 3e4749f7 2020-10-02 op accept network connections.
53 3e4749f7 2020-10-02 op It should be noted that
55 3e4749f7 2020-10-02 op is very simple in its implementation, and so it may not be appropriate
56 3e4749f7 2020-10-02 op for serving site with lots of users.
57 3e4749f7 2020-10-02 op After all, the code is single threaded and use a single process.
59 3e4749f7 2020-10-02 op The options are as follows:
60 3e4749f7 2020-10-02 op .Bl -tag -width 12m
61 3e4749f7 2020-10-02 op .It Fl c Ar cert.pem
62 3e4749f7 2020-10-02 op The certificate to use, by default is
64 3e4749f7 2020-10-02 op .It Fl d Ar docs
65 3e4749f7 2020-10-02 op The root directory to serve.
67 3e4749f7 2020-10-02 op won't serve any file that is outside that directory.
69 3e4749f7 2020-10-02 op Print the usage and exit
70 3e4749f7 2020-10-02 op .It Fl k Ar key.pem
71 3e4749f7 2020-10-02 op The key for the certificate, by default is
75 3e4749f7 2020-10-02 op To quickly getting started
76 6980aad6 2020-10-02 op .Bd -literal -offset indent
77 3e4749f7 2020-10-02 op $ # generate a cert and a key
78 3e4749f7 2020-10-02 op $ openssl req -x509 -newkey rsa:4096 -keyout key.pem \\
79 3e4749f7 2020-10-02 op -out cert.pem -days 365 -nodes
81 3e4749f7 2020-10-02 op $ cat <<EOF > docs/index.gmi
83 3e4749f7 2020-10-02 op test paragraph...
85 3e4749f7 2020-10-02 op $ gmid -c cert.pem -k key.pem -d docs
88 3e4749f7 2020-10-02 op now you can visit gemini://localhost/ with your preferred gemini client.
92 3e4749f7 2020-10-02 op it doesn't support virtual host: the host part of the request URL is
93 3e4749f7 2020-10-02 op completely ignored.
95 3e4749f7 2020-10-02 op it doesn't fork in the background or anything like that.