So, this is my first blog post, on my first blog. It runs on a computer on my bookshelf. What better first article than to explain how (and why) I did it?

🚨
Be warned: I am not an expert in technology, and this is a review of my experience and the tools I used, not a guide.

Let's start with why. I've been taking an interest in self-hosting over the past few months, starting when I picked up a slightly old Dell Optiplex 3050 for a few bucks from an office liquidation. I first installed CasaOS, a nice GUI for home servers with an integrated Docker "app store". I went with it because I was uncomfortable with a command line interface, and didn't have a good working knowledge of Linux. CasaOS works great, but I moved on to Ubuntu Server a little while after, mainly because it obfuscates the file system and makes it harder to learn Docker.

So that's the why. Let's get into how.

Wait, what is Docker? It's a virtualization service that lets you start up programs pretty easily, and sandboxes them neatly too. CasaOS uses it as the backend for its apps, but in my opinion it's so easy to learn it's worth just going straight into Ubuntu + Docker.

Requirements

  • Internet access
  • A domain name
  • A computer able to run Docker containers
  • A VPS (Optional)

My Setup

  • Ubuntu server running Docker on my local network
  • RackNerd Ubuntu VPS server
  • PorkBun domain name
  • (free) CloudFlare DNS account

Making a server

I'm using Ubuntu Server, which seems to be an acceptable standard for Linux. There are infinitely many different distros of Linux, which aren't really worth getting into. The important part is having SSH, being able to open ports, and being able to run Docker.

The specs of my server, using neofetch

Getting a domain

In order to have an easily accessible website, you should have a nice website to point to your IP address.

I rented c0mpl3xy.lol from PorkBun as that's my online username on a few platforms, and I thought a .lol domain would be cool. Generally speaking, .com and .net domains are pretty pricey, I'd recommend looking at .xyz and other less common ones. Note that pricing tends to be cheap for the first year, and increases to a "full" price.

Setting up DNS

Now that you have a domain, you need to point it to the IP address of your server. For PorkBun, you set the the domain of your purchase to your server's external IP.

PorkBun can update your DNS records, but many people use a dedicated DNS provider for more features and separation of dependency. CloudFlare's free tier let's you create a DNS record, and for this project we won't need more than that.

Go into your DNS hosting settings, and remove all nameservers. Add the CloudFlare provided nameservers.

🚨
Important: when adding your DNS records to CloudFlare, make sure proxying is OFF, otherwise your site will have issues loading.

Speaking of servers...

Use a VPS?

💡
A VPS (virtual private server) is a paid server somewhere else on the internet that you are given access to.

I rented a VPS from RackNerd so I could deploy Pangolin (see below). That way, I could open ports for web browsing on my VPS, and could completely avoid opening ports on my home router. I didn't mind the added cost of the VPS (about $13/year), but you can consider if you'd want to open ports on a home router, or skip your home router and deploy solely on a VPS. The VPS I selected has 2TB of monthly traffic, so I can serve a good bit of content, maybe short of 4K streaming.

The RackNerd VPS I went with.

Pangolin

Pangolin is a newer self-hosted service that lets you proxy services from another device.
My primary reason for using this is to forward services from my home server to my VPS without opening ports on my home server. Pangolin has a sister service called Newt that runs on separate machine. Simply put, I'm using it to securely tunnel my apps from my home server and to display my services neatly (this blog running on the domain blog.c0mpl3xy.lol is handled by Pangolin).

The reverse proxying is much easier to set up than other options like Nginx and Caddy, so you should consider using it even if your services are on your local machine.

Ghost

Ghost is a self-hostable blogging platform that has a couple key features bundled in nicely. It has a slick editor, a good selection of themes, and you don't have to monkey with any code to get it working, It has a lot of options for creating mailing lists and getting paid signups, but I disabled all of that.

How I got this blog working.