Hosting this Site

3 minutes read


nginx - The Web Server

As a mix of production and lab, I have servers running Debian stable, Proxmox (Debian with some custom on top), and a few single board computers running services. For this webserver, one of my Tiny/Mini/Micro servers is hosting the docker container running it. Small, low power, and more than enough to handle incoming requests.

In part that is due to the web server software - nginx. Originally designed to solve the C10K problem, nginx is extremely performant, especially when it comes to serving static content like html, css, images, and javascript. The reason for this is entirely under the hood, and a major diversion in architecture from a more traditional webserver, like Apache. nginx is an event-driven architecture.

The major components here are a main process that manages multiple worker processors. Each worker has an event loop, which continuously monitors connections for events (connection ready, incoming data, etc). When those client requests come in, the worker process does not block activity and wait for it to complete - instead, it processes connections that are active and ready. As each operation completes (like reading a file), an event is triggered, and the specific process handling that operation continues. Because of this, you can have a huge number of simultaneous requests come in, and they don’t block each other from operating.

Overall, this makes things really efficient, reliable, and much more performant. Its what made nginx the most popular web server solution today! Considering how integrated Apache once was into just about every content management system (such as Wordpress) out there, its really saying something.

nginx’s efficiency with static files though leads us to the next piece in the puzzle.

Zola - Static Site Generation

One way to reduce the overhead and speed up the site even further is static site generation - rather than dynamically loading content, the entire website gets built into static HTML, CSS, JavaScript, images (including and transformation of those images). Templates, content, and data are all processed before its loaded into the webserver. This also means that the pre-built files are more easily delivered through a CDN (Content Delivery Network), which eases the load on the server and speeds up delivery to the client (user).

While I’ve leveraged other solutions in the past, this site is using Zola. No dependencies, just a single binary written in Rust. Pages are written in markdown, with the addition of shortcodes and internal links to make writing content even easier.

At the end, the entire site is rendered as static files, with no need to worry about any dependencies beside the web server itself. No database, no application server, no API layer to manage - just plain simple files, delivered quickly.