Hacking a Gemini web frontend

Date: 26.05.2020

This page is reachable via https since about some minutes. I've hacked together a small web server based on two Lua modules:

With these modules, it's easy to write a small web server that provides a http interface. As text/gemini is a really simple file format, writing a parser and HTML renderer took me about half an hour of work, with an additional half hour to fix several bugs in the newline rendering.

Note to self: Lua 5.1 is not Lua 5.3 and has some minor differences in pattern matching and such features.

Using nginx, you can easily integrate your own little servers behind some "strong and mature" project with HTTPS serving, virtual hosts and all of that. It only requires this small proxy_pass configuraton:
# /etc/nginx/sites/random-projects
server {
	# Listen on both IPv4 and IPv6
	listen 443 ssl;
	listen [::]:443 ssl;

	server_name random-projects.net;

	# Enable SSL/TLS
	ssl on;

	# This is required to serve index.gemini, otherwise no index files are used.
	index index.gemini;

	location / {
		# This passes the HTTPS request to the Lua script

The Lua server itself runs as a systemd unit and requires some patches in the Environment to find the libraries used:
Description=Gemini-Web Bridge

ExecStart=/usr/bin/lua /home/felix/gemini-web-bridge/main.lua

# These two env variables must be set for Lua to find our packages with require "X"


The project source on GitHub