How cool would it be if you could just host anything straight from your home?
Old ages
Well, in the old ages, you would have to have public IP, solve the problem of port forwarding through your router, make sure your network is secure, take care of every aspect of the hosting, including installing and configuring every single thing like certificates for SSL and stuff like that...
Tedious work... Some of us did it anyway. But, man, was it pain in the pooper.
Today
Today you just install docker, you install cloudflared – software from Cloudflare, you run one docker run
command, you setup your Cloudflare Tunnel to point into the docker and to some subdomain and voila. You are up and running in matter of minutes. Completed with SSL, caching right on Cloudflare's side. I am amazed.
This blog btw runs from my home server that I use for NAS and many other services.
I mean why not? Cloudflare will even show cached version of it if my computer goes to shit as it sometimes does and it's all free of charge.
Example – static server to serve my website
This is my statically made website alesi.cz.
Preparing your static server on docker
- Install and run docker desktop
- Create folder that will go public
- Run the
docker run
for static web server
- And maybe add some index.html into the directory and check that it shows on
http://localhost:8787
Tunneling it to public through your own domain
- First buy domain. You can do it with Cloudflare or any other domain registrar you like, then you add that domain to Cloudflare as new website and you change the NS servers to those Cloudflare presents to you.
- Then you go to Zero Trust admin and there you select Network->Tunnels
- You add tunnel for your domain, you start it by following the instructions Cloudflare gives you, if it gives you option to do some migration just agree with anything.
- In tunnel configuration, just tunnel it to the localhost:8787 and voila, you are serving it to the world. And it created https certificates and all automatically.
How easy and awesome, right?
Well, it works for many other things, so feel free to experiment. I just don't think you should share big files through it if you are on the free version.
****
written by an idiot named Aleš... Nothing to see here