hosting my blog from my apartment

Share

I was wondering if I could host this blog from my apartment. The monthly hosting cost is basically nothing, but somehow it still annoyed me, and more importantly, I was curious whether I could just do it myself.

I recently bought an old Dell office computer to experiment with self hosting, so this seemed like a good excuse to try.

port forwarding: the classic way (I didn't want to)

The traditional approach is to forward a port from my router to the computer running the blog. I didn't really like this idea, it means exposing something inside my home network directly to the internet, and I also didn't feel like figuring out all the details around NAT, firewall rules, and securing it properly.

So I started looking for another option.

cloudflare tunnel: connect out instead of letting the world in

Cloudflare tunnel turned out to be a surprisingly elegant solution. Instead of opening a port and letting the internet connect directly to my computer, my computer makes an outgoing connection to Cloudflare. So the direction is basically:

my computer → Cloudflare → internet

rather than:

internet → my router → my computer

cloudflare then forwards requests for my domain through that tunnel to the web server running on my little Dell machine. No port forwarding required, and nothing on my network is exposed. That felt much nicer.

so now this blog is running in my apartment

The full setup looks like this:

internet
   ↓
Cloudflare
   ↓
Cloudflare Tunnel
   ↓
old Dell computer in my apartment
   ↓
this blog

There's something satisfying about knowing that when someone opens this page, the response is coming from a tiny computer sitting somewhere in my apartment.

would I recommend this?

For learning and experimenting: absolutely. For something important in production: probably not, at least not with my current setup. Right now I have:

  • no redundant disks
  • no automatic backups
  • no redundant internet connection
  • one old computer that could simply decide to stop working

For a blog, I'm fine with all of that. I occasionally export my posts to a JSON file, and if the server goes down for a while, nothing particularly bad happens.

That's actually one of the things I like about this experiment: it doesn't need to be production grade. It just needs to work well enough.

That's the setup for now. If my apartment loses power, so does this post :)