Host Your Blog For Free, At Home, Without Bots Banging Down Your Door

The Internet is a big place. It's also not nearly as nice as it used to be writ large. I would not recommend opening up port 80 on your home router and letting the world in. However there are ways to go about hosting things from home that don't involve doing that. I'm going to go through one such way of doing that in this blog post. There are many services like the one that I will share with you, this is the one that I'm most familiar with.

We're going to set up a service called WriteFreely, and we will tunnel traffic from the Internet directly to the computer that is hosting WriteFreely. Note that, technically, you could use any web server for this. WriteFreely is a nice little blogging platform that is still simple to set up, and isn't just a static site generator.

It should be noted that each of the sections here is its own entire world of rabbit holes. I could easily write an entire blog post on just setting up WriteFreely, or just securely configuring Cloudflare.

If that sounds daunting, don't worry. All of these things are designed to be used by people with minimal expertise in networking and web hosting. Plus, you have me, what could possibly go wrong?

Now, if you want to simply pay someone to host your instance for you and give you a URL to log in at, you can do that. Just check out the page directly on WriteFreel's website about it. If you want to do it yourself, read on.

How can you be sure all of this works? Well, you're reading this post on a system that is set up using the process listed here. :)

Staking Your Claim

The first thing you need to have is a domain. If you already have one, great. If not, there are plenty of ways to to get one. I recommend Namecheap. Once you've purchased a domain, you can begin with the rest of the post. Note that it can take a little while for the domain registration process to finish. You may want to purchase the domain the day before you have time to set things up.

Picking a Computer

I'm going to assume you're comfortable with the idea of running a Linux server for this. If you've never done that before, there are many, many resources out there for spinning things up. I highly recommend you use something like Ubuntu. I use Debian, which Ubuntu is built on top of. If you're using a Raspberry Pi, use Raspberry Pi OS. It's designed to be easy to use, and it's based on Debian. Follow the instructions to install the operating system either on a physical computer or on a virtual machine.

Using virtualization software is well beyond the scope of this tutorial. I, personally, host all of my web presence from KVM guests running Debian on my Linux Mint desktop computer.

Once you've installed your operating system, you can follow the rest of the guide!

Running WriteFreely

WriteFreely is a very small little program written in a language called Go. You can and should follow the instructions on their install page to set it up. I recommend hosting the service on a port like 8080 or 9000 or something else similarly high (but less than 10000 because of stupid silly reasons that aren't important). Really, anything over 5000 and less than 10000 will work just fine. Just make sure you know which number you used!

You can skip anything related to MySQL. I am using MySQL myself (well, MariaDB, but it's the same thing), but you do not need to for a single-user instance of WriteFreely. I'm just a masochist.

Once WriteFreely is running locally (run sudo systemctl status writefreely to check), you can move on to setting up the tunnel.

Signing up for Cloudflare

We're going to be configuring what is called a tunnel. It is, fundamentally, a private connection from a service called Cloudflare to a computer that you own. Cloudflare will, for free, route web traffic going to a domain name that they manage for you to your computer via this tunnel.

You need to pull up Cloudflare, make an account, and register your DNS with Cloudflare. Here is Namecheap's own tutorial on doing this.

Setting Up the Tunnel

Once Cloudflare is in charge of your DNS, you need to set up your tunnel! In the left-hand sidebar, click Zero Trust. On this new page, click the Networks dropdown, also in the left-hand navigation sidebar. From the list that falls out u nderneath, select Tunnels.

Click the Create Tunnel button. Under Select your tunnel type, click the button Select Cloudflared. Give your tunnel a meaningful name. I recommend “WriteFreely”. ;)

You should now be on the Configure page. Make sure you select Debian from the list of options, and (probably) 64-bit. Then, and this part is really important, copy the big block of text under the words “If you don’t have cloudflared installed on your machine” and paste it into your command line.

Wait for that to finish running, and then copy the other text block on the right, and paste that into your terminal. DO NOT SHARE THAT COMMAND WITH ANYONE. This second command has a secret key which allows anyone who holds it to act as though they are your tunnel.

Plugging it All In

This is the last step!

Now you have a couple parts: 1. You have your server which is running WriteFreely on a port like 8080. 2. You have a Cloudflare tunnel which is set up to begin accepting traffic from Cloudflare to this server.

The thing that is missing is the connection from Cloudflare to your server.

In Cloudflare, after you configured your tunnel, you should have the option to click on Public Hostname at the top of the page. Click it. Then click the button labeled Add a public hostname.

In this new page, you can add a Subdomain if you like. For example, the blog you're reading is hosted on write.bauxite.tech. That first part, write, is a subdomain. If your domain will only be used for your blog, you can leave this blank.

From the Domain drop down, select the primary domain name that you signed up with. If you've never done any of this before, it should be the only option.

Leave the Path blank. Let me repeat that: Leave the path blank.

Under Type, select the HTTP option. Then, in URL, type localhost:8080. Note that whatever comes after t he colon is the port number which you configured for WriteFreely. It is very important that those match up!

Then. . .just click Save hostname.

Conclusion

Et voila! You should now be able to point to your new domain and see WriteFreely running. Follow WriteFreely's instructions for setting up your account, and START WRITING!