-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
114 lines (81 loc) · 3.75 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
GLV-1.12556: The First Gemini Protocol Server
It's named after the NASA designation for Gemini 1, which is fitting,
because it's the first Gemini protocol server written.
Features:
* Serves any type of document
* Configurable filenames for default Gemini index files
* Configurable extension for Gemini index files
* Will create a Gemini index file for directories sans a Gemini index file
* Support for CGI
* Gemini-specific CGI scripts
* HTTP-specific CGI scripts
* Support for SCGI
* Gemini-specific SCGI programs
* HTTP-specific SCGI programs
* Support for user directories
* Support for multiple directories per host
* Support for serving up single files
* Support for vitual hosting (multiple domains)
* Support for specifying MIME type per file extension
* Support for files in multiple human languages
* Support for specifying non-UTF-8 character sets
* Support for rewriting URLs internally
* Authentication by client certificates
* Easily extensible with support for custom handlers
Prerequisites:
* Lua >= 5.3 (Lua 5.2 might work, but not fully tested)
* Lpeg >= 1.0.0
* libretls >= 3.3.4 or LibreSSL >= 2.5.0
* GNU libmagic (NOTE: This is NOT image manipulation, but file
identification)
* A whole bunch of Lua modules, availble at:
* https://github.com/spc476/lua-conmanorg
* https://github.com/spc476/LPeg-Parsers
Installation:
This will require some work. You will need to download the modules listed
above from Github and get them installed. Out once you have all the
prerequisites installed, the server should just work.
Bulding:
Just type "make" (there's one C module that might be required, depending
upon your desired configuration). If you have the Lua include files in a
non-standard location, you may need to do:
make LUA_INCDIR=/path/to/Lua/includes
You can do "make install" if you want to install the server onto the system:
make install
This will install files in the following locations:
/usr/local/bin/GLV-1.12556 # server
/usr/local/lib/lua/5.3/GLV-1 # server modules (written in C)
/usr/local/share/lua/5.3/GLV-1 # server modules (written in Lua)
To fine tune, you can from the command line:
make [location] install
The various [location] options are (multiple can be specified)
prefix=target-dir
target-dir/bin/GLV-1.12556
target-dir/lib/lua/5.3/GLV-1
target-dir/share/lua/5.3/GLV-1
LUADIR=target-dir
target-dir/GLV-1 # modules written in Lua
LIBDIR=target-dir
target-dir/GLV-1 # modules written in C
BINDIR=target-dir
target-dir/GLV-1.12556 # server program
If the Lua include files are in a non-standard location, you can specify:
make LUA_INCDIR=/path/to/lua/includes
But you do not need to install anything if you run GLV-1.12556.lua directly
in the Lua subdirectory. The program requires a single argument, the
location of the configuration file.
Configuration:
You will need to generate a certificate, as the protocol requires the use of
TLS. There are plenty of on-line tortorials about generating a self-signed
certificate, or you could use a certificate from Let's Encrypt.
The file "minimal-conf.lua" is the bare minimum configuration file you'll
need to serve up files from a directory, but do look at the sample-conf.lua
file as that has extensive comments about each section and what is required,
and what isn't. It will help to know some Lua, especially Lua string
patterns (its form of regex) as various sections of the configuration are
applied to requests via pattern matching of the request.
To run CGI scripts, you'll need to include the cgi section in the
configuration file, After that, any file that the filesystem handler
encounters that is marked executable will be treated as a CGI script and
run. If CGI is NOT enabled, the server will simply return a temporary error
(and log the condition via syslog()).