WordPress Production
A production-grade WordPress stack running PHP-FPM behind an Nginx reverse proxy for optimal performance. MariaDB 11.4 serves as the relational database with InnoDB buffer pool tuning, while Redis 7 provides persistent object caching to reduce database load. All services include health checks, resource limits, and named volumes for data durability. The frontend/backend network separation ensures that only Nginx is exposed to external traffic. Ideal for hosting high-traffic WordPress sites in a containerised environment.
Enthaltene Services
nginx
nginx:1.27-alpine
wordpress
wordpress:6.7-fpm-alpine
Umgebungsvariablen:
mariadb
mariadb:11.4
Umgebungsvariablen:
redis
redis:7-alpine
Generiertes YAML
# Generated by ComposeHub (composehub.dev)
name: wordpress-production
services:
nginx:
image: nginx:1.27-alpine
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- nginx_conf:/etc/nginx/conf.d
- wordpress_data:/var/www/html:ro
networks:
- frontend
- backend
depends_on:
wordpress:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- "-f"
- http://localhost
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: "0.50"
memory: 256M
reservations:
cpus: "0.10"
memory: 64M
labels:
com.composeforge.description: Nginx reverse proxy serving WordPress
wordpress:
image: wordpress:6.7-fpm-alpine
restart: unless-stopped
expose:
- "9000"
volumes:
- wordpress_data:/var/www/html
environment:
WORDPRESS_DB_HOST: mariadb:3306
WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME:-wordpress}
WORDPRESS_DB_USER: ${WORDPRESS_DB_USER:-wordpress}
WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD:-changeme}
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX:-wp_}
WORDPRESS_CONFIG_EXTRA: define('WP_REDIS_HOST', 'redis'); define('WP_REDIS_PORT', 6379); define('WP_CACHE', true);
networks:
- backend
depends_on:
mariadb:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- php-fpm-healthcheck || exit 1
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
com.composeforge.description: WordPress PHP-FPM application server
mariadb:
image: mariadb:11.4
restart: unless-stopped
command:
- "--innodb-buffer-pool-size=256M"
- "--innodb-log-file-size=64M"
- "--innodb-flush-method=O_DIRECT"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- mariadb_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootchangeme}
MYSQL_DATABASE: ${WORDPRESS_DB_NAME:-wordpress}
MYSQL_USER: ${WORDPRESS_DB_USER:-wordpress}
MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD:-changeme}
networks:
- backend
healthcheck:
test:
- CMD
- healthcheck.sh
- "--connect"
- "--innodb_initialized"
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 256M
labels:
com.composeforge.description: MariaDB relational database
redis:
image: redis:7-alpine
restart: unless-stopped
command:
- redis-server
- "--maxmemory"
- 128mb
- "--maxmemory-policy"
- allkeys-lru
- "--appendonly"
- yes
- "--appendfsync"
- everysec
- "--save"
- "60"
- "1000"
volumes:
- redis_data:/data
networks:
- backend
healthcheck:
test:
- CMD
- redis-cli
- ping
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: "0.50"
memory: 192M
reservations:
cpus: "0.10"
memory: 64M
labels:
com.composeforge.description: Redis object cache for WordPress
networks:
frontend:
driver: bridge
backend:
driver: bridge
volumes:
wordpress_data:
driver: local
mariadb_data:
driver: local
redis_data:
driver: local
nginx_conf:
driver: local
Kurzinfo
- Services
- 4
- Netzwerke
- 2
- Volumes
- 4
Wann verwenden
Dieses Template ist ideal für die Einrichtung einer wordpress production Umgebung. Alle Services sind mit Healthchecks, Ressourcenlimits und sinnvollen Standardwerten vorkonfiguriert. Passen Sie die Umgebungsvariablen an, bevor Sie in Produktion gehen.
Tipps
- Ändern Sie alle Standardpasswörter vor dem Deployment
- Überprüfen Sie die Ressourcenlimits für Ihre Hardware
- Fügen Sie einen Reverse Proxy für HTTPS in Produktion hinzu
- Konfigurieren Sie Backup-Strategien für Daten-Volumes