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 andcompose.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:
-
System Preparation: The system packages are updated, and Docker is installed on the host.
-
Environment Setup: The
ols-docker-envrepository is cloned to/root/ols-docker-env. An environment file (.env) is configured with specific versions: -
OpenLiteSpeed Version:
1.9.2 -
PHP Version:
lsphp84 -
Container Orchestration: The application services are started using Docker Compose within the
/root/ols-docker-envdirectory. -
Domain and Virtual Host Configuration: A script (
bin/domain.sh) is executed to create a new virtual host for the assigned domain. -
Database Provisioning: A database named
wordpress_dbis created via thebin/database.shscript with an administrative user. -
WordPress Installation: The application files and core WordPress setup are performed using the
./bin/appinstall.shscript. -
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
80and443are open to allow web traffic through the Nginx proxy. -
Internal Routing: OpenLiteSpeed is remapped to internal port
8080to prevent conflicts with the external Nginx proxy. -
Proxy Headers: The configuration automatically injects
X-Forwarded-Proto $schemeandHost $hostheaders 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
80is mapped to host port8080. -
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: hostto bind directly to ports80and443. -
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:
-
Navigate to the application directory:
-
Pull the latest images and restart the services:
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_secretsDocker 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:
-
Stop Application: