Running WordPress Cleanly with Docker & Traefik
Описание и применение
Развертывание безопасного WordPress с Docker и Traefik: изолированный MariaDB‑контейнер, корректная обработка HTTPS и устранение циклов перенаправлений.
Задача
Deploy a secure, production‑ready WordPress site that avoids common reverse‑proxy pitfalls and limits the database’s network exposure.
Результат
WordPress is accessible over HTTPS, the database is isolated from the internet, and the site starts reliably after the database health check.
Рабочий процесс
- Create /opt/wordpress directory and enter it
- Write docker‑compose.yml with two services (db and wordpress) and two networks (proxy and intern)
- Set db service to use mariadb:11.8, healthcheck, internal network, persistent volume
- Set wordpress service to use wordpress:7.1.0-php8.5-apache, depend on db health, expose via proxy network, configure WP_HOME/WP_SITEURL and HTTPS detection in WORDPRESS_CONFIG_EXTRA
- Run docker compose up -d
- Verify containers are healthy with docker compose ps
- Confirm HTTPS response with curl -sI https://YOUR_DOMAIN/
- Complete the 5‑minute WordPress install wizard in the browser
Доказательства
WordPress powers a large part of the web – and is notorious for hacked installations.
The database runs in an isolated internal network with no internet access, WordPress gets its HTTPS from Traefik, and we cleanly solve the classic reverse‑proxy pitfall (redirect loop / mixed content).
Traefik terminates TLS and talks to WordPress internally over HTTP. WordPress therefore thinks it's running insecurely and generates http:// links – which leads to mixed‑content errors or a redirect loop.
- Дата записи: 2026-10-20T08:41:30.739Z