WordPress MySQL Nginx Production Compose Starter
Copy a production-oriented WordPress + MySQL + Nginx docker-compose.yml with restart policies and private networking — generated locally, no signup.
WordPress + MySQL + Nginx
Copy a production-oriented WordPress + MySQL + Nginx docker-compose.yml with restart policies and private networking — generated locally, no signup.
此工具在你的浏览器本地运行。你的输入不会被上传。
Copy the generated result or open the full tool to adjust inputs locally.
WordPress + MySQL + Nginx
services:
wordpress:
image: "wordpress:php8.2-fpm"
command: php-fpm
env_file:
- .env
ports:
- "8080:8080"
depends_on:
- db
working_dir: /app
restart: unless-stopped
networks:
- app_network
db:
image: "mysql:8.4"
environment:
MYSQL_DATABASE: "${MYSQL_DATABASE}"
MYSQL_USER: "${MYSQL_USER}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
volumes:
- "mysql_data:/var/lib/mysql"
healthcheck:
test:
- CMD-SHELL
- "mysqladmin ping -h localhost -u${MYSQL_USER} -p${MYSQL_PASSWORD}"
interval: "10s"
timeout: "5s"
retries: 5
restart: unless-stopped
networks:
- app_network
nginx:
image: "nginx:1.27-alpine"
ports:
- "80:80"
volumes:
- "./nginx.conf:/etc/nginx/conf.d/default.conf:ro"
depends_on:
- wordpress
restart: unless-stopped
networks:
- app_network
volumes:
mysql_data: {}
networks:
app_network:
driver: bridge
# .env.example
COMPOSE_PROJECT_NAME=wordpress_prod
APP_PORT=8080
APP_ENV=production
APP_SECRET=change-me
MYSQL_DATABASE=app
MYSQL_USER=app
MYSQL_PASSWORD=change-me
MYSQL_ROOT_PASSWORD=change-me-root
DATABASE_URL=mysql://app:change-me@db:3306/app
DATABASE_PORT=3306
# Commands
cp .env.example .env
docker compose up -d --build
docker compose ps
docker compose logs -f wordpress
docker compose exec wordpress sh
docker compose down
docker compose down -v # remove named volumes and local data
# Notes
MySQL internal: mysql://app:${MYSQL_PASSWORD}@db:3306/app
MySQL local: mysql://app:${MYSQL_PASSWORD}@localhost:${DATABASE_PORT}/app
Preset: WordPress + MySQL + Nginx
Mode: production
Notes:
- Review image tags, commands, and mounted paths for your actual application layout.
- Secrets are represented as environment variables in .env.example; replace placeholder values before use.
- Healthchecks are included for supported infrastructure services.
- Named Docker volumes are enabled for local persistence.
- Warning: Production mode adds restart policies, but this is a starting point and not hardened production infrastructure.
# Warning: Production mode adds restart policies, but this is a starting point and not hardened production infrastructure.Copy a production-oriented WordPress + MySQL + Nginx docker-compose.yml with restart policies and private networking — generated locally, no signup.
WordPress + MySQL + Nginx
It is a strong starter, not a hardened production deployment. Review secrets, TLS, backups, resource limits, and network exposure before production use.
No. Preset generation is static and the interactive builder runs locally in the browser.
Yes. The page exposes copyable and downloadable output for docker-compose.yml and related notes.