Skip to content

Deployment Overview of WordPress with OpenLiteSpeed on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the following requirements must be met:

  • Operating System: Ubuntu (latest stable version).

  • Privileges: Root or sudo access is required for package installation and Docker management.

  • Ports:

  • 80 (HTTP) - Used by Certbot/Nginx for SSL verification.

  • 443 (HTTPS) - Standard encrypted web traffic.

  • 8080 (Internal HTTP) - OpenLiteSpeed internal service port.

  • 7080 (OLS Admin) - Access to the OpenLiteSpeed administration panel.

FQDN of the final panel on the hostkey.in domain

The application uses a specific subdomain template for access and SSL certificate management.

Parameter Value
Prefix wp
Domain hostkey.in
Full template wp{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

The deployment utilizes several directories for configuration, data, and SSL management:

  • /root/ols-docker-env: Contains the core application files, including Docker Compose configurations and installation scripts.

  • /data/nginx/user_conf.d: Stores Nginx reverse proxy configuration files for SSL termination.

  • /data/nginx/nginx-certbot.env: Environment file used by the Certbot container.

  • /root/nginx: Directory containing the Nginx-Certbot Docker Compose setup.

Application installation process

The application is installed using a combination of system package management, Git repository cloning, and specialized installation scripts:

  1. System Preparation: The system packages are updated via apt, and the Docker engine is installed on the host.

  2. Repository Retrieval: The ols-docker-env repository is cloned from GitHub to /root/ols-docker-env.

  3. Environment Configuration:

  4. The .env file is modified to set specific versions: OpenLiteSpeed version 1.9.3 and PHP version lsphp84.

  5. Port mapping is adjusted in docker-compose.yml to rebind the internal OpenLiteSpeed ports (moving them from standard 80/443 to port 8080) to allow the Nginx proxy to occupy the standard web ports.

  6. Container Deployment: The Docker containers for OpenLiteSpeed and phpMyAdmin are started using docker compose up -d.

  7. Virtual Host Creation: A script bin/domain.sh is executed to configure a new virtual host within OpenLiteSpeed based on the generated domain name.

  8. Database Provisioning: A database named wordpress_db is created via the bin/database.sh script with an administrative user.

  9. WordPress Installation: The application files and core configuration are deployed using the ./bin/appinstall.sh script, targeting the newly created database and domain.

  10. SSL Configuration: A Nginx-based proxy is deployed via Docker to handle SSL certificates through Certbot and provide reverse proxying to the OpenLiteSpeed container.

Access Rights and Security

  • Firewall: The system relies on standard port availability for web traffic (80/443).

  • Internal Routing: OpenLiteSpeed is isolated from direct external access on ports 80/443; it listens on port 8080, while Nginx handles the public-facing encrypted traffic.

  • Proxy Headers: Security and routing headers (Host and X-Forwarded-Proto) are automatically injected into the Nginx configuration to ensure WordPress correctly identifies HTTPS requests.

Databases

The application uses a MySQL/MariaDB database managed within the Docker environment.

Parameter Value
Database Name wordpress_db
Connection Method Localhost (via container network)
Storage Location Managed via Docker volumes

Docker Containers and Their Deployment

The deployment consists of two primary container groups: the application stack and the SSL proxy.

OpenLiteSpeed Stack

Located in /root/ols-docker-env/docker-compose.yml.

  • OpenLiteSpeed Container

  • Image: litespeedtech/openlitespeed (version specified via OLS_VERSION)

  • Ports: Internal port 80 mapped to host 8080.

  • Environment: PHP version set to lsphp84.

  • phpMyAdmin Container

  • Image: phpmyadmin (official library image)

SSL Proxy Stack

Located in /root/nginx/compose.yml.

  • Nginx-Certbot Container

  • Image: jonasal/nginx-certbot:latest

  • Ports: 80, 443 (Host mode).

  • Volumes:

  • nginx_secrets:/etc/letsencrypt

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d

  • Environment: CERTBOT_EMAIL set to the administrator's email.

  • Restart Policy: unless-stopped

Custom Scripts and Additional Setup

The following scripts are used during the installation process located in /root/ols-docker-env/bin/:

  • domain.sh: Configures the OpenLiteSpeed virtual host for the specific domain.

  • database.sh: Initializes the MySQL database, user, and permissions.

  • appinstall.sh: Performs the final WordPress application installation and configuration.

Application Update Instructions

To update the main application components:

  1. OpenLiteSpeed/PHP Stack: Navigate to /root/ols-docker-env and run:

    docker compose pull && docker compose up -d
    

  2. Nginx Proxy: To refresh SSL certificates or proxy settings, navigate to /root/nginx and run:

    docker compose up -d
    

Location of configuration files and data

  • Application Data: Managed within the Docker volumes associated with the OpenLiteSpeed container.

  • Nginx Proxy Configs: /data/nginx/user_conf.d/

  • SSL Certificates: Stored in the nginx_secrets Docker volume.

Available ports for connection

Service Port Protocol
HTTP (Proxy) 80 TCP
HTTPS (Proxy) 443 TCP
OpenLiteSpeed Admin 7080 TCP

Starting and Stopping the application

The application is managed via Docker Compose.

  • Starting all services:

    # For Application Stack
    cd /root/ols-docker-env && docker compose up -d
    
    # For Proxy Stack
    cd /root/nginx && docker compose up -d
    

  • Stopping all services:

    # For Application Stack
    cd /root/ols-docker-env && docker compose down
    
    # For Proxy Stack
    cd /root/nginx && docker compose down
    

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×