This repository provides a docker compose
setup to run a self-hosted WordPress instance, complete with a MySQL database, phpMyAdmin, and WP-CLI.
It is pre-configured to join a shared Docker network, allowing easy integration with other services like n8n.
- Uses official Docker images for WordPress, MySQL, phpMyAdmin, and WP-CLI.
- Includes a full-featured environment for development and management.
- Persists WordPress files and MySQL data in local volumes (
./data/wp
and./data/wp-db
). - Pre-configured for a shared network for easy inter-service communication.
- Includes helper scripts for easy management (
restart-docker.sh
,update-docker.sh
). - Includes a
backup.sh
script for creating compressed database backups. - Includes a sample
Caddyfile
for use with a reverse proxy.
-
Clone the repository:
git clone https://github.com/AiratTop/wordpress-self-hosted.git cd wordpress-self-hosted
-
Create the shared network: If it doesn't exist yet, create the shared Docker network:
docker network create shared_network
-
Configure environment variables: Create a
.env
file and specify your database credentials. -
Start the services:
docker compose up -d
- WordPress: http://localhost:8888
- phpMyAdmin: http://localhost:8081
- Start:
docker compose up -d
- Stop:
docker compose down
- Restart:
./restart-docker.sh
- Update:
./update-docker.sh
(Pulls the latest Docker images and restarts) - Backup:
./backup.sh
(Creates a compressed backup in thebackups
directory) - WP-CLI: Use
docker compose exec wp-cli wp <command>
. For example:# List installed plugins docker compose exec wp-cli wp plugin list
This setup is designed to work with the n8n-self-hosted configuration. Since both services are on the shared_network
, you can connect to MySQL from n8n using the following credentials:
- Host:
wp-db
- Port:
3306
- Database, User, Password: (As specified in your
.env
file)
Check out other self-hosted solutions:
- postgresql-self-hosted: A simple and robust PostgreSQL setup.
- mysql-self-hosted: A self-hosted MySQL instance.
- clickhouse-self-hosted: High-performance columnar database for analytics.
- metabase-self-hosted: Self-hosted Metabase on Docker for business intelligence and analytics.
- qdrant-self-hosted: A vector database for AI applications.
- redis-self-hosted: A fast in-memory data store, often used as a cache or message broker.
- caddy-self-hosted: A modern, easy-to-use web server with automatic HTTPS.
- wordpress-self-hosted: Production-ready WordPress stack with MySQL, phpMyAdmin, and WP-CLI.
- n8n-self-hosted: Scalable n8n with workers, Caddy for auto-HTTPS, and backup scripts.
- monitoring-self-hosted: Self-hosted monitoring stack with Prometheus and Grafana.
- ollama-self-hosted: Ready-to-use solution for running Ollama with the Open WebUI on Docker.
- authentik-self-hosted: Authentik is a flexible, open-source Identity & Access Management (IAM) solution.
- gatus-self-hosted: Automated service health dashboard with a PostgreSQL backend and backup scripts.
This project is licensed under the MIT License - see the LICENSE file for details.
Airat Halitov
- Website: airat.top
- GitHub: @AiratTop
- Email: mail@airat.top
- Repository: wordpress-self-hosted