A modern and secure WordPress project that uses Docker to simplify development and deployment. This project includes optimized configurations for both production and local development.
- WordPress - Content Management System
- Docker & Docker Compose - Containerization and orchestration
- MySQL - Database
- PHP - Backend programming language
- Composer - PHP dependency manager
- Akismet - Anti-spam plugin
- JWT Authentication - Secure authentication for REST API
- vlucas/phpdotenv - Environment variable management
wordpress/
βββ π composer.json # PHP dependencies
βββ π composer.lock # Locked PHP dependencies
βββ π docker-compose.yml # Docker services configuration (port 9000)
βββ π Dockerfile # WordPress container configuration
βββ π .dockerignore # Docker ignore rules
βββ π deploy.yml # Deployment configuration
βββ π environment.php # Environment configuration
βββ π .gitignore # Git ignore rules
βββ π .htaccess # Apache configuration
βββ π wp-config.php # WordPress configuration
βββ π wp-config-sample.php # Sample WordPress configuration
βββ π index.php # WordPress entry point
βββ π wp-*.php # WordPress core files
βββ π xmlrpc.php # XML-RPC endpoint
βββ π scripts/
β βββ π start.sh # Startup script
β βββ π check-ports.sh # Port conflict checker
βββ π logs/ # Application logs
βββ π mysql/
β βββ π init/
β βββ π 01-init.sql # DB initialization script
βββ π vendor/ # Composer dependencies
βββ π wp-admin/ # WordPress admin panel
βββ π wp-content/ # Custom content
β βββ π plugins/ # Installed plugins
β β βββ akismet/ # Anti-spam plugin
β β βββ hello.php # Hello Dolly plugin
β β βββ jwt-authentication-for-wp-rest-api/ # JWT authentication
β β βββ secure-custom-fields/ # Secure custom fields
β β βββ woocommerce/ # E-commerce plugin
β βββ π themes/ # Custom themes
β β βββ classic-core-theme/ # Classic core theme
β β βββ core-theme/ # Core theme (parent)
β β βββ core-theme-child/ # Core theme child (FSE ready)
β β βββ index.php # Theme index
β βββ π languages/ # Translation files
β βββ π uploads/ # Media files
β βββ π cache/ # Cache files
βββ π wp-includes/ # WordPress core files
βββ π README.md # This file
π§ Access Port: The project is configured to run on port 9000 (http://localhost:9000)
Before you begin, make sure you have installed:
- Docker (version 20.10+)
- Docker Compose (version 2.0+)
- Git
- Composer (optional, for local development)
Create a .env file at the project root:
cp .env.example .envEdit the .env file with your settings:
# Database Configuration
WORDPRESS_DB_HOST=mysql
WORDPRESS_DB_USER=wordpress
WORDPRESS_DB_PASSWORD=wordpress_password
WORDPRESS_DB_NAME=wordpress
# WordPress Configuration
WORDPRESS_DEBUG=true
WORDPRESS_CONFIG_EXTRA=
# JWT Configuration
JWT_AUTH_SECRET_KEY=your_very_long_and_secure_secret_key
# FTP Configuration (for deployment)
FTP_SERVER=your_ftp_server
FTP_USERNAME=your_ftp_user
FTP_PASSWORD=your_ftp_password
DEPLOY_DIR=/path/on/server# Build and start all services
docker-compose up -d
# View logs in real time
docker-compose logs -f
# Stop the services
docker-compose down# Give execution permissions to the script
chmod +x scripts/start.sh
# Run the startup script
./scripts/start.shOnce the containers are running:
- WordPress Frontend: http://localhost:9000
- WordPress Admin: http://localhost:9000/wp-admin
- phpMyAdmin: http://localhost:8081
If you need HTTPS for development:
# 1. Generate SSL certificates
./scripts/generate-ssl.sh
# 2. Start with SSL
docker-compose -f docker-compose.yml -f docker-compose.ssl.yml up -d
# 3. Access with HTTPS
- **WordPress Frontend**: https://localhost
- **WordPress Admin**: https://localhost/wp-admin- Go to http://localhost:9000
- Select your language
- Complete the site information:
- Site title
- Admin user
- Password
- Click "Install WordPress"
# Check the status of services
docker-compose ps
# Rebuild containers
docker-compose up -d --build
# Run commands inside the container
docker-compose exec wordpress wp --info
# View logs for a specific service
docker-compose logs wordpress
# Stop and remove containers
docker-compose down -v# View WordPress information
docker-compose exec wordpress wp --info
# List plugins
docker-compose exec wordpress wp plugin list
# Activate plugin
docker-compose exec wordpress wp plugin activate plugin-name
# Update WordPress
docker-compose exec wordpress wp core update# Access MySQL
docker-compose exec mysql mysql -u wordpress -p wordpress
# Backup the database
docker-compose exec mysql mysqldump -u wordpress -p wordpress > backup.sql
# Restore backup
docker-compose exec -T mysql mysql -u wordpress -p wordpress < backup.sqlTo deploy to production: