Setting up Ghost on a Homelab: The Trust-Proxy Trap and Other Gotchas, Part 1
Setting up Ghost on a Homelab: The Trust-Proxy Trap and Other Gotchas, Part 1
So, youâve decided to host Ghost in your homelab. Congratulations! Youâre about to embark on a journey filled with thrills, chills, and probably some mild exasperation. But fear not. Like a cat prowling its territory, Iâm here to guide you through the maze.
The Ghost in the Machine
First, a quick rundown on why youâd want Ghost running on your own hardware. Ghost is a powerful, open-source platform aimed at professional publishing. Itâs sleek, fast, and focuses on content creation. Having it in your homelab means you have full control over your data. Plus, itâs a delightful way to flex your sysadmin muscles.
Setting the Stage: Prerequisites
Before we dive into the pitfalls, letâs cover the basics. You'll need a server with Node.js (v18.x or later), MySQL 8.0 (or MariaDB equivalent), and a taste for adventure. Oh, and did I mention a reliable proxy like Traefik or Nginx? Youâll need that too.
The Trust-Proxy Trap
Now, onto the infamous trust-proxy trap. What is it, you ask? Imagine telling Ghost to trust your reverse proxy to handle SSL and forward all the important headers correctly. Sounds straightforward, right? But without configuring this, you may find yourself locked out of admin routes or stuck in an HTTP-only world.
// In your config.production.json
{
"url": "https://yourdomain.com",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "ghost",
"password": "yourpassword",
"database": "ghost_prod"
}
},
"paths": {
"contentPath": "content/"
},
"mail": {
// Mail configuration here
},
"logging": {
"transports": ["file", "stdout"]
},
"process": "systemd",
"persistence": {
"provider": "local"
},
"trustProxy": true
}
The trustProxy setting is the magic key. Set it to true if youâre using a proxy, and Ghost will behave like a well-trained feline, trusting the proxy to tell it whether the request is HTTP or HTTPS. Forgetting this is like forgetting to feed your catâit wonât end well.
Other Common Gotchas
While the trust-proxy is the main headline, donât overlook these other potential roadblocks:
- Port Conflicts: Ensure nothing else is trying to snatch port 2368 out from under Ghostâs paws.
- Database Connection: Double-check your credentials. Ghost is picky and wonât hesitate to ghost you if it canât connect to the database.
- File Permissions: Ghost needs permission to access its files. Donât make it beg.
In Conclusion
Setting up Ghost in your homelab can be as rewarding as catching a laser pointer, but be prepared for a few gotchas along the way. Remember to configure your proxy settings correctly, and youâll be shining like the top cat you are. Stay tuned for the next installment, where weâll go deeper into optimizing performance and handling updates.
Until next time, keep those tails in the air and those proxies trusted.