Gmid

From ParabolaWiki
Jump to: navigation, search

gmid is a full-featured server for the Gemini hypertext protocol, with a "small, hackable codebase" written in C. It uses an event-based asynchronous I/O model; and supports modern features, which one might expect from a web server - such as virtual hosts, reverse proxy, default error pages, server-side page generation (via CGI and FastCGI), and Unicode hostnames/URIs (via punycode and IRI). It also can make use of Linux security features, such as 'seccomp' and 'landlock'.

1 Configuration

Gmid can be run locally in "config-less mode" for experimentation; but for production (public) use, you will need a domain name, and an SSL certificate for that domain.

If you keep the default config file (/etc/gmid/conf), files will be served from /srv/gemini/. The following commands will create a useful SSL certificate, automatically detected per the default config file:

 $ N_DAYS=42000               # this can be any integer (the number of days before the certificate expires)
 $ DOMAIN=gemini.myserver.net # this must be your domain or subdomain name
 $ sudo openssl genrsa -out /etc/ssl/private/gmid.key 4096
 $ sudo openssl req -new -x509                     \
                    -key /etc/ssl/private/gmid.key \
                    -out /etc/ssl/certs/gmid.pem   \
                    -days $N_DAYS -nodes           \
                    -subj "/CN=${DOMAIN}"
 $ sudo chmod 400 /etc/ssl/certs/gmid.pem /etc/ssl/private/gmid.key
Note: Some advanced features (sch as "chroot mode" and CGI scripting) may require the server root and files to be owned by the 'gmid' user.
 $ sudo mkdir -p /srv/gemini/
 $ sudo chown -R gmid:gmid /srv/gemini/

See man gmid for advanced configuration details.

2 Serving Documents

The document format is a very simple Markdown variant, called "gemtext". A sample home page will be installed at: /usr/share/gmid/index.gmi. Simply copy it to the server root (/srv/gemini/), to get started.

 $ sudo cp /usr/share/gmid/index.gmi /srv/gemini/

The Project Gemini website has a complete "gemtext" Markdown syntax guide.