4. Hosting and Docker
For complete control and perfect performance, WordPress is deployed via Docker Compose on loca.zone.
🐳 Optimal Stack Configuration
An ideal docker-compose.yml for WordPress includes:
- Nginx (Web Server): Handles TLS termination, static asset delivery, rate limiting, and FastCGI caching.
- PHP-FPM (Application): Isolated execution environment for WordPress. Tuned with dynamic process management and OPcache enabled.
- MariaDB (Database): Optimized for high-read workloads, leveraging InnoDB buffer pool adjustments.
- Valkey (Object Cache): Memory store for cached database queries.
PHP-FPM OPcache Tuning
Critical environment variables for php.ini:
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1Docker Compose Best Practices
- Network Isolation: Put the database and Valkey on an internal Docker network, completely inaccessible from the outside world.
- Volume Management: Mount
/var/www/html/wp-contentas a named volume, but treat WordPress core files as ephemeral or build them directly into a custom Docker image. - Resource Limits: Explicitly define CPU and memory limits (
deploy.resources) for each container to prevent runaway PHP processes from crashing the host node.