Brian Kotch

← 随筆一覧に戻る (Back to Blog)
Article 随筆October 2026

Modern Multi-Service Architecture with Apache, Docker & Terraform

DevOpsTerraformDockerApacheNext.js
随筆

Modern Multi-Service Architecture with Apache, Docker & Terraform

Published: October 2026
Tags: DevOps, Terraform, Docker, Apache, Next.js

Monolithic single-server setups often get replaced by sprawling Kubernetes clusters that rack up huge cloud bills. But for many production systems, a well-architected Linux box orchestrated with Terraform, Docker Compose, and an Apache 2.4 reverse proxy delivers extreme performance, resilience, and simplicity.


Why Apache as a Modern Reverse Proxy?

While NGINX and Caddy get a lot of modern attention, Apache 2.4 remains one of the most mature, reliable reverse proxies available when properly configured:

  • mod_proxy & mod_proxy_http: High-concurrency socket pooling to containerized loopback services.
  • WebSocket Upgrade Routing: Seamless bidirectional support for Next.js Fast Refresh and WebSocket channels.
  • Granular Path Routing: Routing / to Next.js (port 3000), /v1/bio and /api/node/ to Express (port 8080), and /prime or /weather to Python Flask (port 9000) under a single TLS certificate.

Zero-Downtime Infrastructure as Code

By managing the entire machine in Terraform:

  1. Base packages, firewall rules, and systemd units are codified in devops/terraform.
  2. Static Hugo sites utilize atomic symlink directory swaps (releases/<timestamp> -> current).
  3. Containerized microservices restart rolling containers on loopback ports without dropping client connections.
  4. Let's Encrypt certificates automatically renew through Certbot hooks.
和敬清寂 · All Rights Reserved Brian Kotch