loading . . . I’ve decided to move my personal site stack away from free providers to my own server, for education and fun.
## Drivers
### Simplicity
I’ve spent so much time over the years figuring out how to wire together services, just because I haven’t gone all in and owning my stack. The allure has been “free static hosting! free serverless! free cron jobs!”. But for what? I think it’s faked simplicity for yourself, since you buy (in best case you buy) the freedom of not worrying about managing a service, but you spend time reading the docs of `$provider` and getting more and more locked in, rather than reading `man` pages and crafting Nginx configs.
Sure, it’s not for everybody. Many _front of the frontend_ devs might not want to deal with this Unix stuff. So it’s great that there are hosting providers which enables them to do more and more powerful things. _But I’m done with it._
### Independence
In the end, all of the above comes down to me as paternalising: to be constrained by the whims of a rando devops startup or by GitHub’s current tech leadership. Also impostor syndrome in myself, believing I don’t have the skills to run a Linux server myself.
But I want to learn new things! Have fun! Tinker! Get back into curiosity and using 30+ year old established Unix tools. Knowledge and skills which translate between jobs, providers, and technological landscapes.
I’d rather spend time setting up something I own and control to avoid receiving that dreaded email that `$provider` has a) been bought up, b) is cutting my plan, c) going out of business.
### Fun
I’m plain bored and want to learn more about this.
## “How do I learn all of this?!”
Turns out Linux servers are kind of popular of running software on. Meaning, there are _a ton_ of docs online. Either StackOverflow, the project’s docs, or blog posts. It foresaw this would be overwhelming, and that I’d end up with my regular 20+ browser tab bullshit at 01:00 in the night. Therefore… I set out to _complement_ my learning by using an LLM to keep momentum up.
I’m fully aware about the pros and cons with LLMs. In hindsight, using it to help me with this setup was super beneficial to me, in order to not get stuck and bail on the whole thing. But you need to cross reference _everything_ with real documentation, because:
1. **Security.** The LLM might be incorrect about best practices. Search around Linux-y communities to get an understanding what seems to be the canonical way of doing a thing. Let the LLM provide 1-3 options, and investigate them closer yourself.
2. **Learning.** I type out everything the LLM suggests myself. Shell commands, configs, everything. If there’s a new command or flag I don’t recognise, I instantly look it up. I _don’t_ want to get lazy or dependant on an LLM.
The great power from using an LLM to help me set all this up was _speed_. As in developer velocity. Not that I’m in a hurry — learning these things isn’t something you do overnight. But in order to build my own intuition, the LLM was helpful in providing an embryo of a plan. If I’d be married to a god mode Unix sysadmin, I would’ve surely asked them in place of a chat bot. But that would’ve been annoying for them — LLMs don’t get annoyed (yet).
I basically wanted the velocity of asking stupid questions which were either hard or time consuming to get an answer to by traditional methods (back to that “20+ browser tab” swamp).
## The plan
This not a tech deep dive with detailed steps. Just an illustration of easy, to me, deploying a static site was.
_Note:_ one thing I will keep (for now) in my stack is Cloudflare, for DNS, CDN, and SSL. I’m not hardcore enough yet to replace that, even though I know Cloudflare can be seen as Problematic™.
### Getting a server
Turns out, paying for a service is a stronger guarantee of getting treated better than being on a free plan. I signed up for a Hetzner Cloud server, and it costs me around €4 per month (!). That gives me a fully fledged Ubuntu server, **hosted in the EU.**
Then there were some locking down to do. See the links below. Standard “don’t run as `root`″, update packages, enable firewall, configure a solid SSH setup stuff.
I especially liked how one can conf SSH to enable super simple logging in to my server. Now I just do:
ssh myserver
thanks to the minimal config in `~/.ssh/config`:
Host *
AddKeysToAgent yes
UseKeychain yes
Host myserver
HostName <ip>
IdentityFile ~/.ssh/<ssh-key>
User <custom user on the server>
### Host the static site
Easy:
1. **Get the static HTML to the server.** I contemplated going simple and just let `rsync` to be my deploy step (no CI/CD, no GitHub Actions, ahhhh…). But I realised I need to trigger rebuilds and deploys when `git push`-ing new content to the repo. So I ended up with a bare Git repo, and the then a checked out working copy in the nginx site directory, and a `post-receive` hook in the former which triggered and built the site into the latter.
2. **Set up and configure nginx.** Install it, add a simple config for a static site, symlink, restart nginx.
Reload nginx, refresh browser, worked.
### DNS and custom domain
I added an `A` record in the DNS panel with a subdomain for a domain I own, pointing to my server’s IP, proxied through Cloudflare. Amended the nginx config to include the new domain.
Reload nginx, refresh browser, worked.
### HTTPS
You can use Let’s Encrypt and Certbot for this, I believe. But I noticed Cloudflare has this Origin Server certificate thing. This means, I could generate a certificate pair from their dashboard, physically put them on my server, and amend my nginx config. It included redirecting HTTP traffic from port 80 to the `https` protocol, and listening on port 443 for the HTTPS traffic.
Reload nginx, refresh browser, worked. Tears of joy.
* * *
## Outro
I spent a total of one (1) evening on this. It’s insane. The simplicity hosting providers promise is such a scam, if this was all it took. I’m embarrassed it took me all these years to running my own site (for €4 per month!). Now I’ve unlocked _a ton_ of things. Do I want some kind of Node server running? A cron job? A database? Just build it, man. The PaaS gaslighting of Johan stops now.
There are endless opportunities.
## Inspiration and docs
* _Tech Independence_ by Derek Sivers
* _Hosting a static website using nginx_
https://johan.im/micro/20251114082651/