Running Multiple Servers

Full Setup available here.

When I started my gemini capsule I added some hobby stuff to the page. Specifically info about amateur radio. My webpage for amateur radio is pretty "old school" with no JS, very little CSS and all generated using Linux command line tools. As I never remember to update it I thought I might as well make the transition to just use Gemini and point my gemini to http proxy and all is good.

The issue is I already have this capsule running on my VPS where I also host that page. I could use a different port but that is always sucks. Similar to how hosting multiple sites on a single box, I found that you can use nginx to proxy incoming connections based on the SSL cert used and direct them to a specific server. Setup multiple gemini servers on different ports and now I have both pages working:

gemini.sh0.xyz

ad0qm.com

Configuration

Two changes needed to be done:

nginx config

Next to the http section in your nginx.conf file, the following can be added to support streams and direct them to a proxy server based on TLS Server Name Indication (SNI) address reported.

In nginx.conf load the module:

Then after the http section add the following configuration:

Add entries to the map and an upstream for each server you want to connect.

Thanks to prouxi over on Reddit for the config file.

systemd config

Systemd supports instances by creating service files with @ in the name. The value after @ can be used in the service file, just put %i in any value.

/lib/systemd/system/molly-brown@.service

I created two config files, /etc/molly-sh0.conf and /etc/molly-ad0qm.conf. Each has a different port configured. Start and enable both:

$ published: 2023-03-11 23:20 $

$ tags: #gemini $

-- CC-BY-4.0 jecxjo 2023-03-11

Comments?

back