Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Running WordPress Cleanly with Docker & Traefik

说明与用途

使用 Docker 和 Traefik 部署安全的 WordPress:隔离 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