Docker · NGINX · WordPress · MariaDB · 42 Common Core
Inception
A small web infrastructure where every service lives in its own container, built from my own Dockerfiles instead of ready-made images.
The problem
The problem
Serve a WordPress site over HTTPS with a database behind it, where each service is isolated, configured from the outside and keeps its data when a container is rebuilt.
What I built
- Three services, each in its own container: NGINX with TLS 1.2/1.3, WordPress on PHP-FPM, and MariaDB.
- A dedicated Docker network; NGINX talks to PHP-FPM over FastCGI on it.
- Bind-mounted volumes so the database and the site files survive container recreation.
- A Makefile to build, stop, rebuild and wipe the whole stack.
Technical decisions
- No pre-built images: every service has its own Dockerfile.
- One responsibility per container, so a service can be rebuilt without touching the others.
- All configuration in environment variables (srcs/.env), none baked into the images.
- The TLS certificate is generated when the container starts, not committed to the repo.
What makes it hard
- Getting the start order right: WordPress needs the database ready, and NGINX needs PHP-FPM.
- Keeping state outside containers that are meant to be thrown away.
What I can do because of it
- Containerise a multi-service app and wire it together with Docker Compose.
- Configure NGINX as a TLS-terminating reverse proxy.
- Keep secrets and settings out of images, and data out of containers.