โ† Back to articles
WEB / CONTAINERS

Web Hosting with Docker and Nginx

For my personal website, I prepared a setup to serve static files with Nginx, manage the container with Docker Compose and use a separate HTTPS layer for external access.

What are the components?

The site consists of HTML, CSS, JavaScript and PDF files. The home page, technical notes and certificates share one file structure. Nginx serves this content, while Docker Compose keeps the container ports, mounts and service settings in a single file.

HTML / CSSPages and styling
NginxStatic web server
ComposeContainer configuration

How are files mounted into the container?

In my Compose configuration, the website folders are mounted read-only into the Nginx container. When I add an article or image, updating the content files is enough. Nginx itself is configured from a separate file.

services:
  website:
    image: nginx:stable-alpine
    ports:
      - "127.0.0.1:8088:80"
    volumes:
      - ./assets:/usr/share/nginx/html/assets:ro
      - ./blog:/usr/share/nginx/html/blog:ro

This is a shortened Compose example. The full file also mounts the home page, certificates and Nginx configuration.

What did broken visuals teach me?

In the first local preview, incorrect asset paths caused styling to fail. I learned to keep CSS and images in the assets/ folder, use relative paths and preserve the directory structure. index.html cannot be moved on its own.

Health checks and HTTPS

The Nginx configuration returns a simple 200 OK response at /healthz. The Compose health check can probe this endpoint. For public access, I plan a separate HTTPS termination layer; a solution such as Cloudflare Tunnel can expose the internal site through a domain without opening a modem port.

Status note: This article describes my prepared web hosting configuration and intended publishing workflow. It does not claim that external HTTPS access or performance testing has been completed.