Running a modern webserver

At dotGo 2015 I realized I had to regain an online presence. I had to build a site again, on which I could post an occasional blog-post.

I’m not good at building sites, graphically, so bear with me on that point. This site might look ugly for a while.

The reason I’m building a site/blog again is because I’m using some interesting tech. For this webserver for example. It’s using a secure connection, with a certificate that was automatically authorized. And because of this TLS connection it can run HTTP/2. How?

Caddy

Enter Caddy. A brand-new webserver built for ease of use. It features HTTP/2 from the start, which is awesome.

Compared to the most commonly used webserver, the configuration is very simple. This site is built using Hugo, which makes it a static site, and the configuration needed to expose this site using Caddy is simple:

http://luit.eu {
   root /home/luit/web/luit.eu/public
}

If I want more, I can use the hugo plugin to automatically rebuild the site. Or I can use the git plugin to automatically fetch the site data from a git repository.

So that’s a good start, but it’s not using HTTP/2 in this configuration. To get HTTP/2 you’ll need HTTPS first. I recently gained access to the limited beta of Let’s Encrypt, making this very easy.

Let’s Encrypt

Using the latest beta build of Caddy I tried using the built-in support for Let’s Encrypt. To enable this for this site, I changed my config to become the following:

luit.eu {
    root /home/luit/web/luit.eu/public
}

If you can’t spot what I added to the config you’re looking for the wrong thing; I actually had to REMOVE something to enable a feature! Remove the http:// and Caddy defaults to serving http and https on the default ports for you. Requiring a certificate it’ll then automatically request one at Let’s Encrypt, complete the challenge required by it, and start using it seconds later.

So now I have a blog that’s accessable over IPv6 through HTTP/2, secured automatically using Let’s Encrypt. It might not look fancy (yet?), but behind the scenes it’s quite awesome.