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.
-
Domain: A valid FQDN pointing to the server IP is required for SSL certificate issuance via Certbot.
-
Ports:
-
80(HTTP/TCP) - Required for Let's Encrypt validation. -
443(HTTPS/TCP) - For secure web traffic. -
7080(OpenLiteSpeed Admin) - Access to the server management interface.
FQDN of the final panel on the hostkey.in domain¶
The application is accessible via a dynamically generated subdomain based on the server ID.
| Parameter | Value |
|---|---|
| Prefix | wp |
| Domain | hostkey.in |
| Full template | wp{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The deployment utilizes several specific directories for configuration and data persistence:
-
/root/ols-docker-env: Contains the application environment, Docker Compose files, and installation scripts. -
/root/nginx: Stores the Nginx reverse proxy configuration and Certbot orchestration files. -
/data/nginx/user_conf.d: Location of custom Nginx virtual host configurations. -
/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 orchestration, and specialized installation scripts:
-
System Preparation: The system packages are updated, and the Docker engine is installed.
-
Environment Setup: The
ols-docker-envrepository is cloned to/root/ols-docker-env. The environment configuration is modified to use OpenLiteSpeed version1.9.2and PHP versionlsphp84. -
Container Orchestration: Docker Compose is used to launch the OpenLiteSpeed container, with ports remapped to avoid conflicts with the reverse proxy (internal port
8080). -
Virtual Host Creation: A script (
bin/domain.sh) is executed to configure a new virtual host within OpenLiteSpeed for the specific domain. -
Database Provisioning: A database named
wordpress_dbis created via a dedicated script (bin/database.sh). -
WordPress Installation: The WordPress application is installed and configured using the
./bin/appinstall.shscript, which links the web files to the newly created database. -
SSL Configuration: A reverse proxy container is deployed to handle SSL termination and automatic certificate renewal via Certbot.
Access Rights and Security¶
-
Firewall: Ensure ports
80,443, and7080are open in the system firewall. -
Reverse Proxy: An Nginx container acts as a security layer, handling SSL/TLS termination and forwarding traffic to the OpenLiteSpeed container.
-
Headers: Security headers such as
X-Forwarded-Proto httpsandHostare configured to ensure correct routing and secure communication between the proxy and the backend.
Databases¶
The application uses a MySQL/MariaDB database managed within the environment:
-
Database Name:
wordpress_db -
Connection Method: Local connection via the OpenLiteSpeed container network.
-
Storage Location: Managed by the Docker volume associated with the OpenLiteSpeed service.
Docker Containers and Their Deployment¶
The deployment consists of two primary containers:
OpenLiteSpeed Container¶
-
Image:
litespeedtech/ols-docker-env(Version 1.9.2) -
Ports:
8080:80(Internal mapping),7080:7080 -
Environment Variables:
-
PHP_VERSION:lsphp84 -
Restart Policy: Default Docker restart policy.
Nginx Certbot Container¶
-
Image:
jonasal/nginx-certbot:latest -
Ports: Uses
network_mode: hostto bind directly to system ports80and443. -
Volumes:
-
nginx_secrets:/etc/letsencrypt: For SSL certificate storage. -
/data/nginx/user_conf.d:/etc/nginx/user_conf.d: For custom proxy configurations. -
Environment Variables:
-
CERTBOT_EMAIL: Configured via the admin email address. -
Restart Policy:
unless-stopped
Custom Scripts and Additional Setup¶
Several scripts are used during the deployment process to automate complex configurations:
-
bin/domain.sh: Configures OpenLiteSpeed virtual hosts for the target domain. -
bin/database.sh: Automates the creation of the WordPress database and user. -
./bin/appinstall.sh: Performs the core WordPress installation, including file extraction and configuration.
Application Update Instructions¶
To update the main application, perform the following steps:
-
Navigate to the application directory:
cd /root/ols-docker-env. -
Pull the latest images and restart the services:
Location of configuration files and data¶
-
WordPress Files: Located within the OpenLiteSpeed container volumes.
-
Nginx Proxy Configs:
/data/nginx/user_conf.d/{domain}.conf -
SSL Certificates: Managed via the
nginx_secretsDocker volume.
Available ports for connection¶
| Service | Port | Protocol |
|---|---|---|
| Web Application (HTTPS) | 443 | TCP |
| Web Application (HTTP) | 80 | TCP |
| OpenLiteSpeed Admin | 7080 | TCP |