In the world of web hosting, it’s hard to get excited about new HTTP servers. In fact, if you need to setup a web application stack, chances are you’ll just go with one of the big names you already know, Nginx or Apache. These are both tried and true technologies, but what if you’re new to the game? What if you just want to dive in and start developing or writing, without having to read a handful of tutorials just to get your web server up? Well, I believe the solution to your problem has arrived. Allow me to introduce you to Caddy, a web server built for developers, writers, and designers alike.

If you’re a seasoned pro in web hosting, you’re probably asking yourself, ‘Why another HTTP server?’ It’s a good question, and the Caddy FAQ attempts to answer this by stating that ‘Fundamentally, Caddy aims to make websites easier by lowering the barrier to entry’. It’s a lofty goal, but one I feel they have accomplished, along with so much more. Let’s take a deeper look.

Go

Caddy is written in the Go language and is a very fresh open source project that has only been around for just under 1 year. Many popular open source projects such as Docker, Kubernetes, or InfluxDB have proven the power of Go, and the fact that even large companies like Dropbox have moved to Go from Python, claiming significant performance increases, shows why Caddy’s creator, Matt Holt, chose it. As the Go community grows, Caddy looks like a good place for Go developers of any skill level to contribute to, or learn from an open source project.

Barrier to Entry

The philosophy behind Caddy is to create a web server that is easy for the non technical user to setup and run. Let’s take a look at how easy it is to get a website up with Caddy. I’ll do this on my Macbook.

Download Caddy

The download page is very user friendly. As a user you are given options of the features you want your Caddy installation to include, and the platform you are on. When you click your platform, your binary is built for you on the spot, and downloaded immediately after.

Unzip the archive and open a terminal

I unzipped it in my Downloads folder.

It created a folder called ‘caddy_darwin_amd64_custom’.

cd ~Downloads/caddy_darwin_amd64_custom

sudo ./caddy

Then in my browser: http://localhost:2015/README.txt (README.txt is a text file that was included in the download). Simply add HTML files into this same directory and load them the same way you would the README.txt above.

And that’s it. This took me all of about 3 minutes to accomplish. I’d say that qualifies as a very easy install process. Of course the deeper into web development you go, you may need more advanced features from your web server. You can accomplish this by adding a Caddyfile. The Caddyfile is Caddy’s configuration file, and gives you the opportunity to add functionality and features to your web server. There are many directives that can be found in their easy to read user guide.

Let’s Encrypt

One of the coolest features of the Caddy web server, is the fact that it is the first and only web server to serve all live sites over HTTPS by default. This is accomplished by using the Let’s Encrypt Certificate Authority, which allows users to serve SSL sites for free. With Caddy, serving your content over a secure link has never been easier. In addition to this amazing achievement, the default TLS cipher suite that comes with Caddy scores well with sites such as https://www.ssllabs.com/ssltest/.

HTTP/2

HTTP/2 is the second major version of the HTTP protocol, which is based on Google’s SPDY protocol. Of course all of your current websites will still run on this protocol, with the promise of greater speed and performance. Many of the popular web servers require a module to enable the new protocol, but Caddy supports this by default. It’s one of the reasons why Caddy can be considered a new generation of web server.

FastCGI

If you’ve ever had to setup a PHP application with FastCGI, chances are you’ve mulled through dozens of tutorials, along with several Stack Overflow posts to figure out why the things you did from your tutorial aren’t working. Caddy has simplified this process by, once again, integrating the FastCGI functionality as a default feature, making it as simple to add as a one liner in the Caddyfile. For example:

fastcgi / 127.0.0.1:9000

Markdown

Yet another feature that sets Caddy apart from the rest is its default support of Markdown files. Markdown is a plain text, formatting syntax, which is aimed at helping new users create formatted web content with basic, or no prior HTML knowledge. It is considered by some an easier alternative to HTML, and some flavor of its syntax is supported in many apps we use on a daily basis, like Slack and Github. The Caddy Blog is written in markdown, to illustrate a common use case. The mere support of Markdown out-of-the-box will allow a non technical user such as a writer or a designer, to create a website with relative ease.

Proxying and Load Balancing

The list of out-of-the-box features that Caddy supports is long, and the fact that it supports Load Balancing and can also be used as a Proxy server, is no exception. In my experience, the “go to” applications for this sort of thing have been HAProxy or Nginx, and considering that Caddy also supports health checks and common load balancing algorithms, it should be added to that list as well. It’s also worth mentioning that Caddy supports proxying websockets, so it can be a viable replacement to the common proxying tools used in websocket applications.

Addons

Even with so many useful features provided by default, there are also a handful of Addons that can provide functionality that one might need. Here are some notable ones:

git

This addon git clones a repository into the site and periodically does a git pull on that repository, making it possible to deploy new code with a simple ‘git push’. Cool!

jsonp

This addon allows for JSONP GET requests.

search

Another attempt at making life easier for the developer is the search addon, which activates a search engine that includes a search page and JSON API. The search is powered by bleve, and at this moment will only index HTML, Markdown and plain text files. This is a promising addon that can take the complexity out of providing search on your static sites.

If the functionality one’s looking for doesn’t exist, the ambitious developer can add it themselves using the Caddy extension guidelines.

Embedded Systems

Because the Caddy executable is a lightweight, portable, static, binary file, it can be run on just about any platform it’s compiled on. This adds a lot of potential for the maker world to use Caddy as a lightweight web server on the Raspberry Pi or Arduino platforms. Caddy can even run on newer Android phones using the Linux ARM architecture.

Go Try It!

While the question of ‘why another web server?’ may still remain in some minds, the low barrier to entry for the non technical crowd, default HTTPS functionality, and a rich out-of-the-box feature set assures that Caddy is definitely something to keep an eye on. I am definitely excited about this web server, and plan on writing more “How To” blog posts about Caddy in the future. Now I challenge you to go try it. Surely you must have at least 5 minutes to spare.