Self Host Ghost Behind Cloudflare Tunnel
Introduction: Self Host Ghost Behind Cloudflare Argo Tunnel 🛡️
If you've followed our previous guide on self-hosting Ghost with Docker, you may now want to expose it to the world on a specific URL! Let's take your Ghost blog a notch higher by setting it up behind a Cloudflare tunnel, enhancing security and performance. Let's jump in!
Step 1: Setting up Cloudflare
First things first, we need to prepare the environment for Cloudflare. Here's what you do:bash
These commands will log you in, create a directory, and move the essential certificate file.
Step 2: Create the Cloudflare Tunnel 🚇
Execute this command to create a tunnel specifically for codetalks.net
:
Caution! ⚠️
Handle certificates with care! Mistakes can lead to security vulnerabilities. Make sure you understand these commands fully.
Step 3: Docker-Compose Integration
Add the cloudflared section below to your existing Docker Compose file:
Make sure to update the cloudflare tunnel UUID!
In the above the cloudflared tunnel UUID is "9a9a9a9abf-ff61-4b50-bd0d-a9b67a5b18df" - note you need to change it twice (in one spot it will end in .json
, the other time it won't!
What's Happening Here?
You're adding a Cloudflare container that will establish a secure tunnel between your Ghost blog and Cloudflare's network. Voila! Your self-hosted Ghost blog in a few lines of code!
Note - make sure the DNS records point to the cloudflare argo tunnel!
Step 4: Verification and Deployment
Ensure everything looks good, and run your Docker Compose:
docker-compose down && docker-compose up -d
Conclusion: Your Ghost, Now More Secure! 🎉
By setting up Ghost behind a Cloudflare tunnel, you've just securely exposed your blog to thhe world on your OWN domain.
Still have questions? Struggling with something? Reach out, and let's find the solutions together!
Happy blogging! 🚀