From 62243cd0b5262e14df7e7b5b7103b5b2e006cab5 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Wed, 19 May 2021 23:46:22 +0100 Subject: Add more to css --- .../index.html | 33 +++++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'www/posts/gemini/2021-02-08/how-to-host-your-own-gemini-site-in-the-cloud/index.html') diff --git a/www/posts/gemini/2021-02-08/how-to-host-your-own-gemini-site-in-the-cloud/index.html b/www/posts/gemini/2021-02-08/how-to-host-your-own-gemini-site-in-the-cloud/index.html index f92d177..b918199 100644 --- a/www/posts/gemini/2021-02-08/how-to-host-your-own-gemini-site-in-the-cloud/index.html +++ b/www/posts/gemini/2021-02-08/how-to-host-your-own-gemini-site-in-the-cloud/index.html @@ -5,6 +5,9 @@ How to Host Your Own Gemini Site in the Cloud + + + @@ -28,12 +31,12 @@ $ ufw enable

Harden SSH

I edited the /etc/ssh/sshd_config PasswordAuthentication no

Since I'd made changes to the configuration I needed to restart the SSH service.

$ service sshd restart

Create non-root User

Whenever I access a server I like to login as a non-root user that is able to run sudo on the system.

$ adduser gemini
 
 $ usermod -aG sudo gemini

As the SSH key is already on the server I can copy it to the non-root user account.

$ rsync --archive --chown=gemini:gemini ~/.ssh /home/gemini

On my local system I confirm that I can log in as the new user without a password.

$ ssh gemini@davidtsadler.co.uk -i ~/.ssh/davidtsadler.co.uk/id_rsa

I also confirm that I have sudo access.

$ sudo ls

Installing a Gemini Site and Server

Directory structure

I decided to go with a very simple directory structure. Each site will be a sub-directory in ~/sites that will be named after the domain name. Then each site will have the following sub-directories. The idea is that I may want to host more than one site in the future.

I created the directory structure with the below command.

$ mkdir -p ~/sites/davidtsadler.co.uk/{bin,certs,public,scripts}

Install certificates

Sine the Gemini protocol encourages using a self-signed certificate I installed one with the openssl command.

$ openssl req -x509 \
--newkey rsa:4096 \
--keyout ~/sites/davidtsadler.co.uk/certs/key.rsa \
--out ~/sites/davidtsadler.co.uk/certs/cert.pem \
--days 3650 \
--nodes \
--subj "/CN=davidtsadler.co.uk"

Create Some Test Content

I created a very simple index.gmi file purely for testing.

$ cat << EOF > ~/sites/davidtsadler.co.uk/public/index.gmi
+    -newkey rsa:4096 \
+    -keyout ~/sites/davidtsadler.co.uk/certs/key.rsa \
+    -out ~/sites/davidtsadler.co.uk/certs/cert.pem \
+    -days 3650 \
+    -nodes \
+    -subj "/CN=davidtsadler.co.uk"

Create Some Test Content

I created a very simple index.gmi file purely for testing.

$ cat << EOF > ~/sites/davidtsadler.co.uk/public/index.gmi
 # Welcome
 
 Hello world!
@@ -49,13 +52,13 @@ $ chmod u+x agate

I wrote a very simple bash script to run agate #!/bin/bash /home/gemini/sites/davidtsadler.co.uk/bin/agate \ ---content /home/gemini/sites/davidtsadler.co.uk/public/ \ ---key /home/gemini/sites/davidtsadler.co.uk/certs/key.rsa \ ---cert /home/gemini/sites/davidtsadler.co.uk/certs/cert.pem \ ---addr [::]:1965 \ ---addr 0.0.0.0:1965 \ ---hostname davidtsadler.co.uk \ ---lang en-GB + --content /home/gemini/sites/davidtsadler.co.uk/public/ \ + --key /home/gemini/sites/davidtsadler.co.uk/certs/key.rsa \ + --cert /home/gemini/sites/davidtsadler.co.uk/certs/cert.pem \ + --addr [::]:1965 \ + --addr 0.0.0.0:1965 \ + --hostname davidtsadler.co.uk \ + --lang en-GB EOF $ chmod u+x ~/sites/davidtsadler.co.uk/scripts/start

Testing the Site

At this point I have the Gemini server installed and a site available for testing.

I first started agate with the bash script.

$ ~/sites/davidtsadler.co.uk/scripts/start
@@ -75,6 +78,8 @@ WantedBy=default.target

I then started this service and confirmed it was $ sudo systemctl status agate.service -Active: active (running)

The final step was to have this service start when the system is rebooted.

$ sudo systemctl enable agate.service

Conclusion

Setting up a Gemini site was easy to do and I hope this guide shows it. I have several ideas about how I'm going to use this new site and I'm excited to see where this leads to.

Links

Gandi.net - My domain registrar of choice.Hetzner - My cloud server provider.Agate - A simple Gemini server.davidtsadler.co.uk - My Gemini site.Gemini - Read More Posts.

I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.

Email david@davidtsadler.comThe contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Copyright © 2021 David T. Sadler.

Return to Homepage. +Active: active (running)

The final step was to have this service start when the system is rebooted.

$ sudo systemctl enable agate.service

Conclusion

Setting up a Gemini site was easy to do and I hope this guide shows it. I have several ideas about how I'm going to use this new site and I'm excited to see where this leads to.

Links

Gandi.net - My domain registrar of choice.Hetzner - My cloud server provider.Agate - A simple Gemini server.davidtsadler.co.uk - My Gemini site.Gemini - Read More Posts.

I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.

Email david@davidtsadler.com

License

The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Copyright © 2021 David T. Sadler.

Return to Homepage. + + -- cgit v1.2.3-13-gbd6f