How a Website Actually Works β The Gardenβs Journey
Ever type a URL and wonder what really happens? Letβs follow your browserβs journey when you visit https://garden.christianjeremia.com β explained like youβre five. π§
The Big Picture
You type: garden.christianjeremia.com
β Phone Book (DNS)
β‘ Security Check (SSL)
β’ The Doorman (Caddy)
β£ The Server (Nginx)
β€ The House (VPS)
You see: A beautiful garden page π»
Each step has a job. Letβs dive into each one.
β DNS β The Phone Book of the Internet βοΈ
What is it?
DNS stands for Domain Name System. Think of it as the phone book of the internet.
| Real world | Internet world |
|---|---|
| You want to call βPizza Hutβ | You want to visit βgarden.christianjeremia.comβ |
| You look up their number | Your computer looks up their IP address |
| You dial the number | Your browser connects to the IP address |
| βHello, Pizza Hut!" | "Hello, server!β |
Every computer on the internet has a number (IP address) like 43.133.130.60. But humans are bad at remembering numbers β weβre good at remembering names like garden.christianjeremia.com. DNS is the system that translates names to numbers.
How it happens (simplified)
Your browser: "Where is garden.christianjeremia.com?"
β
Your phone/ISP: "Let me ask the internet phone book..."
β
Cloudflare (our DNS provider): "It's at 43.133.130.60"
β
Your browser: "Got it! Now I'll visit 43.133.130.60"
Who pays for this?
Nobody! DNS is free. You pay for the domain name (christianjeremia.com) β about $7.85/year to Cloudflare β and they give you free DNS management.
Why Cloudflare DNS?
Cloudflare is our phone book operator. When you bought christianjeremia.com, Cloudflare said βgreat, you can manage all the subdomains hereβ:
| Subdomain | What it points to |
|---|---|
garden.christianjeremia.com | β Your VPS (IP: 43.133.130.60) |
christianjeremia.com | β Vercel (portfolio) |
β‘ SSL β The Security Guard π
What is it?
SSL stands for Secure Sockets Layer (okay, actually itβs TLS now, but everyone says SSL). Itβs the padlock π you see in your browser bar.
What does it do?
Two things:
- Encryption β Scrambles the data so no one can read it
- Identity proof β Proves the website is who it says it is
Without SSL
You: "Hi, I want to read the garden!"
β
Hacker: "I'm the garden, trust me! Here's a fake page."
β
You: "Looks real enough..." π± (hacker steals your data)
With SSL
You: "Hi, I want to read the garden!"
β
Garden: "Here's my ID card signed by Cloudflare.
You can trust me. Let's speak in secret code."
β
You & Garden: Chat in encrypted language that only you two understand π€
How Cloudflare handles it for us
In our setup, Cloudflare does the SSL work. The conversation goes:
You ββHTTPS (encrypted)βββ Cloudflare ββHTTP (plain)βββ Your VPS
Your browser talks to Cloudflare securely. Cloudflare talks to your VPS in plain HTTP. This is called SSL Termination β Cloudflare handles the hard crypto work so your VPS doesnβt have to.
We set Cloudflare to Flexible mode, which means:
- β You get the green padlock
- β Your VPS doesnβt need to handle SSL
- β οΈ The last mile (Cloudflare β VPS) is unencrypted (but itβs fine for a static garden with no passwords!)
β’ Caddy β The Doorman πͺ
What is it?
Caddy is a reverse proxy. Fancy term. But really, itβs a doorman for your server.
Analogy: An Apartment Building
Imagine your VPS is an apartment building at 43.133.130.60:
43.133.130.60 (Apartment Building)
βββ πͺ Door 8080 β ποΈ Nginx lives here (the gardener)
βββ πͺ Door 80 β πͺ Caddy lives here (the doorman)
Without Caddy, visitors would have to know the specific door number: http://43.133.130.60:8080. Ugly, right?
Caddy stands at Door 80 (the main entrance) and says:
Visitor at Door 80: "I'm here for the garden!"
Caddy: "Ah, garden.christianjeremia.com! Let me send you to
Room 8080 where Nginx is."
Visitor at Door 80: "I'm here for /"
Caddy: "The garden's entrance is at /notes/index. Follow me!"
Caddy sends them to: /notes/index (clean, no port number!)
What Caddy solves
| Before Caddy | After Caddy |
|---|---|
http://43.133.130.60:8080 | https://garden.christianjeremia.com |
Port :8080 visible in URL | No port visible |
Ugly redirect: http://...:8080/notes/index | Clean redirect: /notes/index |
| Direct IP access | Domain-based routing |
Caddyβs actual config
http://garden.christianjeremia.com {
redir / /notes/index 301
reverse_proxy localhost:8080
}Translation:
- βWhen someone visits
garden.christianjeremia.com/, tell them to go to/notes/indexinsteadβ - βFor everything else, hand it off to the program at
localhost:8080(which is Nginx)β
β£ Nginx β The Server ποΈ
What is it?
Nginx (pronounced βEngine-Xβ) is a web server. Itβs the actual librarian that finds the right book (file) and hands it to the visitor.
Analogy: A Library
Visitor: "I want to read /notes/what-is-nginx"
β
Caddy (doorman): "Go to room 8080, Nginx will help you"
β
Nginx (librarian): "Let me find that book..."
Nginx looks:
1. Is there a file called `/notes/what-is-nginx`? β
2. Is there a file called `/notes/what-is-nginx.html`? β
Found it!
Nginx: "Here you go!" π
Why Nginx and not just Caddy?
Caddy is great at being a doorman (routing, redirects, SSL). But Nginx is lightning fast at serving static files. The split is:
| Caddy | Nginx |
|---|---|
| Routes visitors to the right place | Serves the actual files |
| Handles redirects | Serves HTML, CSS, JS, images |
| Talks to the outside world | Stays in the back, only talks to Caddy |
| 1 job: welcome + redirect | 1 job: serve files fast |
The try_files trick β Clean URLs
This is where the magic of clean URLs happens:
try_files $uri $uri.html $uri/ =404;When you visit /notes/what-is-nginx, Nginx:
- Tries
/notes/what-is-nginxβ not a file - Tries
/notes/what-is-nginx.htmlβ found it! β - (Would try
/notes/what-is-nginx/directory if #2 failed) - (Would show β404 Not Foundβ if all failed)
This is why you can type garden.christianjeremia.com/notes/what-is-nginx without the .html β Nginx figures it out for you.
β€ VPS β The House π
What is it?
VPS stands for Virtual Private Server. Itβs a computer in a data center thatβs always on, always connected to the internet.
Analogy: Renting a Room
Your laptop VPS
ββββββββββββ ββββββββββββββββ
β You write β β Always-on β
β notes hereβ β computer in β
β (Obsidian)β β Singapore β
ββββββββββββ ββββββββββββββββ
β β
β Git push/pull β Serves files
βΌ βΌ
GitHub βββββββ sync βββββββ VPS
Your laptop is like a phone β you turn it on/off, carry it around. The VPS is like a house β itβs always there, always ready.
Whatβs inside our VPS?
VPS (Tencent Cloud, Singapore, 2GB RAM)
βββ π /home/ubuntu/obsidian-vault/ β Raw notes (markdown files)
βββ π /home/ubuntu/quartz-site/ β Quartz builder
βββ π /home/ubuntu/quartz-site/public/ β Built website (HTML files)
βββ πͺ Caddy (port 80) β Doorman
βββ ποΈ Nginx (port 8080) β Librarian
βββ π€ Hermes Agent (Jeri) β AI assistant
βββ ποΈ Git β Sync with GitHub
How data flows from VPS to you
Internet
VPS ββββββββββββββββββββββββββββββββββββββ Your Browser
β β
β Built HTML files β Shows the page
β (inside /public/) β Renders CSS
β β Runs JavaScript
β β Displays images
The VPS doesnβt βsendβ data actively β it waits for someone to ask. When your browser asks βgive me /notes/indexβ, the VPS says βhere you go!β and sends the file.
The Full Journey β From Start to Finish π¬
Letβs trace every step when you visit https://garden.christianjeremia.com:
Step 0: You type "garden.christianjeremia.com" in your browser
and press Enter.
Step 1: π DNS Lookup
Your browser: "Who is garden.christianjeremia.com?"
Cloudflare: "It's at IP 43.133.130.60"
Step 2: π SSL Handshake
Your browser: "Hello, I'd like a secure connection"
Cloudflare: "Here's my certificate. We're safe now."
(Your browser & Cloudflare create an encrypted tunnel)
Step 3: π©οΈ Cloudflare processing
Cloudflare receives your HTTPS request.
Cloudflare: "Hmm, this is for the garden.
Let me forward it to the VPS."
Cloudflare decrypts your request, then sends it
as plain HTTP to your VPS on port 80.
Step 4: πͺ Caddy (The Doorman)
Caddy on port 80 receives: "GET /"
Caddy: "Root request? Let me redirect you to /notes/index"
Caddy sends back: "Go to /notes/index instead"
(This redirect is RELATIVE β no port number!)
Step 5: π Browser follows redirect
Your browser: "OK, I'll go to /notes/index instead"
Same DNS β Same SSL β Same Cloudflare β Same Caddy
Step 6: πͺ Caddy (Again)
Caddy on port 80 receives: "GET /notes/index"
Caddy: "Not a root request. I'll pass this to Nginx."
Caddy forwards to localhost:8080
Step 7: ποΈ Nginx (The Librarian)
Nginx on port 8080 receives: "GET /notes/index"
Nginx: "Let me find that file..."
1. /notes/index β not a file
2. /notes/index.html β FOUND! β
Nginx reads the file and sends it back.
Step 8: π€ Response goes back
Nginx β Caddy β Cloudflare β Your Browser
Step 9: π Your browser renders the page
The HTML tells your browser:
- "Load these CSS files" β makes it pretty
- "Load this JavaScript" β makes it interactive
- "Show this text" β the actual content
- "Load these images" β pictures and icons
Step 10: You see:
π§ Second Brain β Digital Garden
"Welcome to the digital garden..."
β¨ Done in about 0.3-1 second!
Summary Table
| Layer | Name | Job | Analogy |
|---|---|---|---|
| β | DNS (Cloudflare) | Translates domain β IP | Phone book π |
| β‘ | SSL (Cloudflare) | Encrypts your connection | Security guard π |
| β’ | Reverse Proxy (Caddy) | Routes visitors, handles redirects | Doorman πͺ |
| β£ | Web Server (Nginx) | Finds and serves files | Librarian ποΈ |
| β€ | VPS (Tencent) | The actual computer that runs everything | The house π |
Why So Many Layers?
Good question! Why not just use one program for everything?
| One giant program | Multiple small programs |
|---|---|
| Does everything, but nothing great | Each does one job perfectly |
| If it breaks, EVERYTHING breaks | If one breaks, others still work |
| Hard to upgrade | Can upgrade individually |
| In our case: hard to get clean URLs | Caddy cleans URLs, Nginx serves fast |
Itβs like having separate tools in a toolbox:
- A hammer for nails π¨
- A screwdriver for screws πͺ
- A saw for wood πͺ
You could hammer a screw, but itβs better to use the right tool for each job.
Related
- What is Nginx β More detail about our web server
- Garden Domain & HTTPS Setup β How the domain was configured
- How Hermes Agent Works β The Engine Behind Jeri β The AI helping run all this
π Back to Notes
Made with π§ explanations β questions? Ask Jeri!