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) - Managed by the Certbot Nginx proxy.

  • 443 (HTTPS) - Managed by the Certbot Nginx proxy.

  • 8080 (Internal HTTP) - Used for OpenLiteSpeed internal communication.

  • 7080 (OpenLiteSpeed Admin) - Available via configuration if required.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain generated based on your server ID.

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

File and Directory Structure

The deployment utilizes several key directories for configuration and data persistence:

  • /root/ols-docker-env: Contains the application source, Docker configuration files, and installation scripts.

  • /root/nginx: Stores the Nginx Certbot proxy configuration and compose.yml.

  • /data/nginx/user_conf.d: Contains custom Nginx configuration files for the specific domain.

  • /data/nginx/nginx-certbot.env: Environment file for the Nginx container.

Application installation process

The application is installed using a combination of package management, Docker containers, and specialized installation scripts:

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

  2. Environment Setup: The ols-docker-env repository is cloned to /root/ols-docker-env. An environment file (.env) is configured with specific versions:

  3. OpenLiteSpeed Version: 1.9.2

  4. PHP Version: lsphp84

  5. Container Orchestration: The application services are started using Docker Compose within the /root/ols-docker-env directory.

  6. Domain and Virtual Host Configuration: A script (bin/domain.sh) is executed to create a new virtual host for the assigned domain.

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

  8. WordPress Installation: The application files and core WordPress setup are performed using the ./bin/appinstall.sh script.

  9. SSL Configuration: An Nginx proxy container is deployed to handle SSL termination and automated certificate management via Certbot.

Access Rights and Security

  • Firewall: Ensure that ports 80 and 443 are open to allow web traffic through the Nginx proxy.

  • Internal Routing: OpenLiteSpeed is remapped to internal port 8080 to prevent conflicts with the external Nginx proxy.

  • Proxy Headers: The configuration automatically injects X-Forwarded-Proto $scheme and Host $host headers to ensure WordPress correctly identifies HTTPS connections.

Databases

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

  • Database Name: wordpress_db

  • Connection Method: Local connection via Docker networking.

  • Storage Location: Managed by the Docker volume associated with the OpenLiteSpeed container.

Docker Containers and Their Deployment

Application Container (OpenLiteSpeed)

The main application runs in a Docker environment managed via docker-compose.yml located in /root/ols-docker-env.

  • Image: OpenLiteSpeed (version 1.9.2) with PHP 8.4 (lsphp84).

  • Ports: Internal port 80 is mapped to host port 8080.

  • Restart Policy: Default Docker restart policy.

Nginx Proxy Container

A dedicated container handles SSL and traffic routing.

  • Image: jonasal/nginx-certbot:latest

  • Ports: Uses network_mode: host to bind directly to ports 80 and 443.

  • Volumes:

  • nginx_secrets:/etc/letsencrypt (External volume for SSL certificates)

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d (Custom site configurations)

  • Environment Variables: Configured via /data/nginx/nginx-certbot.env.

  • Restart Policy: unless-stopped

Custom Scripts and Additional Setup

The following scripts are used during the installation process:

  • bin/domain.sh: Used to initialize the virtual host configuration for the domain.

  • bin/database.sh: Automates the creation of the WordPress database and user.

  • ./bin/appinstall.sh: Performs the core WordPress application installation and setup.

Application Update Instructions

To update the main application, perform the following steps:

  1. Navigate to the application directory:

    cd /root/ols-docker-env
    

  2. Pull the latest images and restart the services:

    docker compose pull && docker compose up -d
    

Location of configuration files and data

  • Application Configs: /root/ols-docker-env

  • Nginx Site Configs: /data/nginx/user_conf.d/wp{Server_ID}.hostkey.in.conf

  • SSL Certificates: Managed within the nginx_secrets Docker volume.

Available ports for connection

Port Service Access Type
80 HTTP (Proxy) External
443 HTTPS (Proxy) External
8080 OpenLiteSpeed Internal

Starting and Stopping the application

To manage the application services, use the following commands:

  • Start Application:

    cd /root/ols-docker-env && docker compose up -d
    

  • Stop Application:

    cd /root/ols-docker-env && docker compose down
    

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