Virtual hosting (multiple capsules)

Virtual hosting means serving more than one capsule from a single server — each with its own hostname, certificate, and content root.

This is common when:

How Gemini handles it

Gemini uses TLS, and TLS uses SNI (Server Name Indication). The client sends the target hostname during the TLS handshake — before the Gemini request is even made. The server reads the SNI hostname and selects the correct certificate and content root.

This means each virtual host needs its own TLS certificate (one per hostname). You cannot use a shared certificate across hostnames unless it is a wildcard certificate covering all of them.

Requirements for each virtual host

Setup examples

gmid

gmid handles virtual hosting through multiple server blocks in its config file. Each block is independent:

Restart gmid after config changes. Each capsule gets its own cert and root.

Agate (newer versions)

Agate added virtual hosting support in later releases using a content directory layout. Each subdirectory is named after a hostname:

Start Agate with --content pointing at the parent directory. Check your version's documentation for the exact flag — the interface has changed across versions.

Molly Brown

Molly Brown uses a TOML config. The base config covers the default host; additional virtual hosts are defined in a VirtualHosts table. Refer to Molly Brown's own documentation for current syntax, as it has evolved across versions.

Certificates for virtual hosts

You need a valid certificate for each hostname. Options:

Generating a self-signed certificate per hostname:

Change the CN to match the hostname exactly.

Port

All capsules share port 1965. Virtual hosting works because the server selects the capsule based on the SNI hostname, not the port.

Comparing Gemini servers

Dynamic content with CGI

Back to operating index

Last reviewed: 2026-04-07

Corrections welcome: smdocs@pm.me