Skip to content

spc476/GLV-1.12556

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()).