Basic Web Hosting

Configuring Caddy as a static web server is unreasonably simple. GoAccess makes it trivial to get basic analytics working. Static web hosting is incredibly straightforward nowadays.

I have previously had my own personal website, set up very similarly to this one. Most of the key components of this site were the same:

  • Hosted on a virtual private server
  • All designed and made using Hugo
  • Completely static

This has always been a very trivial website setup. There are absolutely no “moving parts” in the web sense to make this complicated. At the time, setting up all the tools that I wanted to were enough complexity. This newer and ever so slightly more modern version of my site has been far simpler to set up to the point where I think basically anyone who has used ubuntu (or any flavor of Linux-like terminal) enough to be comfortable could do it.

Caddy #

I’ve used Caddy because as its website suggests it really appears to be the ultimate web server. There are a whole host of useful features but the standouts to me are:

  • Automatic HTTPS and automagic TLS certificates
  • Trivially but highly configurable logfiles
  • Extremely simple configuration

The selling point to me is the automatic HTTPS feature. Anything that can automatically improve your web security without active intervention is a huge bonus. Logfile configuration being so simple is also a massive benefit. The default format does work very well though - my entire log file configuration is as follows:

log {
    output file {any path works}
    format json
}

Functionally this is almost all I had to do to set up my caddyfile configuration. Aside from replacing some of their defaults with what I had for my website, this does all I need and was entirely automatically handling all the TLS certification for me.

GoAccess #

Now that log files are set up, GoAccess steps in as the log viewer and interpreter of choice. Out of the box GoAccess provides an extremely simple way to process and understand these otherwise arcane log files. In fact all that needs to be done to view the log files is:

goaccess {log file path} --log-format=caddy

One interesting way that GoAccess can be used is to generate automatic HTML reports. This is as simple as adding the -o {html filename} flag to the command, and comes with the benefit of being able to be sent directly as an email. In the future this is something I will look to configure (email on a VPS is not trivial as I have previously found).

Unattended-Upgrades #

A follow-up from my previous post in making a server secure is to enable unattended upgrades. This is extremely simple to do, and the Ubuntu website describes it in substantial detail. There is literally one line to do this:

sudo dpkg-reconfigure --priority=low unattended-upgrades

By default this “just works” in the sense that it is a background process to automatically download and upgrade things. As with all security features having this be an automatic thing that you don’t have to think about makes it far better.

Almost too easy #

I distinctly remember taking about 2 hours last time I had to configure a VPS, just to host my static web server. At this point, I have maybe spent about 20 minutes configuring all of these tools. The main challenge is reading documentation and debugging small errors, most of which are entirely trivial and easily searched. All of this has made it easier than ever to make and host your own personal website.