Skip to content

aprakasa/wp-lomp-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP-LOMP-Docker

License: MIT Docker Compose PHP OpenLiteSpeed MariaDB Redis

WordPress LOMP stack (Linux + OpenLiteSpeed + MariaDB + PHP) deployed via Docker Compose. Uses LSCache plugin with built-in Redis object cache. All inter-service communication uses Unix sockets for maximum performance.

Features

  • LSCache Plugin — Full-page cache served by OpenLiteSpeed (bypasses PHP entirely)
  • Redis Object Cache — Via Unix socket for minimal latency (/var/run/redis/redis.sock)
  • Unix Sockets — All inter-service communication uses Unix sockets for maximum performance
  • Zero Configuration — Auto-installs WordPress, WP-CLI, and LSCache on first startup
  • Automatic SSL — Let's Encrypt via acme.sh sidecar, auto-provisioned on startup with automatic renewal
  • Direct File Access — WordPress files in ./wordpress/ on the host

Architecture

flowchart TB
    Client(["🌐 Client"])

    subgraph Frontend
        OLS["OpenLiteSpeed<br/>LSCache · SSL · :80/:443/:7080"]
    end

    subgraph Application
        PHP["PHP 8.x<br/>WordPress · LSAPI · PhpRedis"]
    end

    subgraph SSL
        ACME["acme.sh<br/>Let's Encrypt · Auto-renewal"]
    end

    subgraph Data
        MariaDB["MariaDB 12<br/>Database"]
        Redis["Redis 7<br/>Object Cache"]
    end

    Client -->|"HTTP/HTTPS"| OLS
    OLS <-->|"LSAPI Unix socket"| PHP
    PHP -->|"Unix socket"| MariaDB
    PHP <-->|"Unix socket"| Redis
    ACME -->|"Issues/renews certs"| OLS
Loading

What's Inside

Component Version Notes
OpenLiteSpeed latest Web server with built-in LSCache
PHP 8.x (bundled with OLS) LSAPI, PhpRedis 6.3.0
MariaDB 12 InnoDB tuned, socket-only
Redis 7 (Alpine) Unix socket, maxmemory with allkeys-lru eviction
WordPress latest Auto-installed via WP-CLI
WP-CLI latest Auto-installed in entrypoint
LSCache latest Full-page cache + Redis object cache
acme.sh latest Let's Encrypt SSL sidecar with auto-renewal

Quick Start

  1. Clone the repository:
git clone git@github.com:aprakasa/wp-lomp-docker.git
cd wp-lomp-docker
cp .env.example .env
  1. Edit .env with your domain, database credentials, and WordPress admin settings:
nano .env
  1. Start the stack:
docker compose up -d
  1. Access WordPress at http://your-domain

WordPress will be automatically installed on first startup.

SSL Setup (Production)

SSL certificates are automatically provisioned on first startup when enabled. Set these variables in .env:

SSL=1                    # Enable SSL
SSL_STAGING=0            # Use 1 for testing (avoids Let's Encrypt rate limits)
DOMAIN=your-domain.com
EMAIL=admin@your-domain.com

Then start the stack:

docker compose up -d

The acme.sh sidecar container will:

  1. Wait for OpenLiteSpeed to be healthy
  2. Issue a Let's Encrypt certificate via HTTP-01 webroot validation
  3. Install the certificate to the shared ssl/ directory
  4. Start a daemon for automatic daily renewal checks

A self-signed certificate is used as fallback until the real certificate is issued.

Note: The old scripts/setup-ssl.sh script is still available for manual SSL provisioning if needed.

Configuration

All configuration is done via .env (copy from .env.example):

Variable Default Description
DOMAIN localhost Your domain name
EMAIL admin@example.com Admin email (used for SSL)
MYSQL_ROOT_PASSWORD - MariaDB root password
MYSQL_DATABASE wordpress Database name
MYSQL_USER wp_user Database user
MYSQL_PASSWORD - Database password
REDIS_MAXMEMORY 64mb Redis max memory
WP_ADMIN_USER admin WordPress admin username
WP_ADMIN_PASSWORD - WordPress admin password
WP_ADMIN_EMAIL - WordPress admin email
WP_SITE_TITLE WordPress Site title
WORDPRESS_TABLE_PREFIX wp_ Database table prefix
OLS_WORKERS 4 PHP LSAPI children (worker processes)
SSL 0 Enable Let's Encrypt SSL (1 to enable)
SSL_STAGING 0 Use Let's Encrypt staging (1 to avoid rate limits)
TZ UTC Timezone

Production Domain Setup

Set DOMAIN in .env to your domain name. All internal paths use localhost — no config file edits needed. The OLS listener uses a catch-all (*) so it responds to any domain pointing to the server.

WordPress Files

WordPress files are in ./wordpress/ on the host, giving you direct filesystem access. This directory is created and populated automatically on first startup.

Caching

The LSCache plugin (litespeed-cache) is automatically installed and activated on first startup. It provides:

  • Full-page cache served by OpenLiteSpeed (bypasses PHP entirely)
  • Redis object cache using PhpRedis via Unix socket (/var/run/redis/redis.sock)

No additional cache plugins are needed. The Redis object cache connection is pre-configured via wp litespeed-option set during first startup.

Logs

  • OLS logs: ./logs/
  • MariaDB logs: docker compose logs mariadb
  • Redis logs: docker compose logs redis

OLS Admin Panel

Access the OpenLiteSpeed admin panel at http://your-server:7080 with default credentials:

  • Username: admin
  • Password: (check docker compose exec openlitespeed cat /usr/local/lsws/adminpasswd)

Common Commands

# Start all services
docker compose up -d

# Stop all services
docker compose down

# View logs
docker compose logs -f openlitespeed

# Restart OLS only
docker compose restart openlitespeed

# Access WordPress CLI
docker compose exec openlitespeed wp --path=/var/www/vhosts/localhost/html --allow-root <command>

Requirements

  • Docker Engine 20.10+
  • Docker Compose V2
  • 1GB RAM minimum (2GB recommended)

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors

Languages