Imagine launching a WordPress site in under 30 minutes without touching a single server config file. That’s the promise of Docker, and with HostCreed’s offshore VPS infrastructure, it’s easier than ever to deploy a production-ready WordPress site with blazing performance and bulletproof security.
Whether you’re running a personal blog, a crypto news portal, or an international e-commerce store, this guide will walk you through setting up WordPress on a HostCreed VPS using Docker Compose. We’ll cover everything from the initial Docker setup to SSL termination with Traefik and performance tuning for maximum uptime.
Why Docker for WordPress on HostCreed VPS?
Traditional WordPress installations often involve juggling PHP versions, MySQL configs, and SSL certificates. Docker simplifies this by containerizing each service:- Isolation: Each component (WordPress, database, cache) runs in its own container.
- Scalability: Easily add more containers as traffic grows.
- Portability: Move your stack between HostCreed’s Netherlands or Ukraine servers without reconfiguration.
- Security: Reduce attack surface by limiting service exposure.
Prerequisites
- A HostCreed VPS (Ubuntu 22.04 recommended)
- SSH access to your VPS
- A registered domain name pointing to your VPS IP
- Docker and Docker Compose installed
Step 1: Connect to Your HostCreed VPS
SSH into your VPS:ssh root@your_vps_ip
Update your system:
apt update && apt upgrade -y
Step 2: Install Docker and Docker Compose
Install Docker:curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Install Docker Compose:
apt install docker-compose -y
Verify installations:
docker --version
docker-compose --version
Step 3: Create Your WordPress Directory
mkdir -p ~/wordpress-docker
cd ~/wordpress-docker
Step 4: Create Your docker-compose.yml File
Create the Docker Compose configuration:touch docker-compose.yml
Open it with nano or vim and paste the following:
version: '3.8'
services:
# Reverse Proxy with SSL
traefik:
image: traefik:v3
command:
- "--api.dashboard=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
- "--certificatesresolvers.letsencrypt.acme.email=your@email.com"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- traefik_data:/letsencrypt
networks:
- web
restart: unless-stopped
# WordPress Application
wordpress:
image: wordpress:latest
depends_on:
- db
- redis
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: your_strong_password
WORDPRESS_TABLE_PREFIX: wp_
WORDPRESS_REDIS_HOST: redis
WORDPRESS_REDIS_PORT: 6379
WORDPRESS_REDIS_PASSWORD: your_redis_password
labels:
- "traefik.enable=true"
- "traefik.http.routers.wordpress.rule=Host(`yourdomain.com`)"
- "traefik.http.routers.wordpress.tls.certresolver=letsencrypt"
- "traefik.http.services.wordpress.loadbalancer.server.port=80"
volumes:
- wordpress_data:/var/www/html
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
networks:
- web
- internal
restart: unless-stopped
# MariaDB Database
db:
image: mariadb:latest
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: your_root_password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: your_strong_password
volumes:
- db_data:/var/lib/mysql
- ./mysql_init:/docker-entrypoint-initdb.d
networks:
- internal
restart: unless-stopped
# Redis Cache
redis:
image: redis:alpine
environment:
REDIS_PASSWORD: your_redis_password
volumes:
- redis_data:/data
networks:
- internal
restart: unless-stopped
volumes:
traefik_data:
wordpress_data:
db_data:
redis_data:
networks:
web:
external: true
internal:
external: false
Create an uploads.ini file to increase file upload limits:
touch uploads.ini
Add these contents:
file_uploads = On
upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 300
Step 5: Deploy Your WordPress Stack
Start all services:docker-compose up -d
Monitor the startup process:
docker-compose logs -f
Step 6: Complete WordPress Installation
Open your browser and navigate to your domain. You’ll see the WordPress setup wizard. Enter your site title, admin username, password, and email.Step 7: Performance Tuning
Enable Redis Object Cache in WordPress:- Log into your WordPress admin dashboard.
- Install and activate the “Redis Object Cache” plugin.
- Go to Settings > Redis and click “Enable Object Cache.”
docker exec -it wordpress_container_name bash
Add this to your uploads.ini or create a new php.ini:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=2
opcache.fast_shutdown=1
Step 8: Backup and Monitoring
Set up automated backups:docker exec -it wordpress_db_1 mysqldump -u wordpress -pwordpress wordpress > backup.sql
Monitor your containers:
docker stats
Why HostCreed VPS Makes This Even Better
Deploying WordPress with Docker on HostCreed’s offshore VPS infrastructure gives you more than just a website. You get:- Privacy-First Hosting: Host in the Netherlands or Ukraine with content-friendly policies.
- High-Performance Hardware: KVM virtualization with NVMe storage ensures your WordPress site loads in milliseconds.
- Enterprise DDoS Protection: Keep your site online during traffic spikes or attacks.
- 99.9% Uptime SLA: Reliable hosting for your global audience.