How to virtualhost on Gemini using Tor

published: 2020-11-14


This guide will assume you are using a Debian-based system.

  1. Install Tor and Jetforce, a Gemini server.

sudo -H pip3 install jetforce; sudo apt install tor

  1. Set up a Tor hidden service.

Add the following lines to /etc/tor/torrc, adjusting as necessary:

HiddenServiceDir /var/lib/tor/gemini/
HiddenServiceVersion 3
HiddenServicePort 1965 127.0.0.1:1966

1965 is Gemini's default port and the one clients will expect the server to be listening on. 1966 will be the actual port the second server instance is running on. This will allow the server serving the clearnet version to use the default port. Do not worry about the port numbers not matching; Tor will redirect Tor traffic on 1966 to the proper server to look like it is also running on 1965.

If you need multiple hidden services, copy these lines again, changing the HiddenServiceDir path to a different one and changing 1966 to a different port not in use.

  1. Configure Jetforce.

Run the following to start the server:

jetforce --host 127.0.0.1 \
--tls-certfile /path/to/certificate.crt \
--tls-keyfile /path/to/key.key \
--dir /path/to/gemsite/files/ \
--hostname YOUREXTREMELYLONGONIONHERE.onion \
--port 1966

CC BY-NC-SA 4.0 © Vane Vander