Skip to content

Deployment Overview of WordPress on Server

Prerequisites and Basic Requirements

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

  • Operating System: A Linux-based system with Docker and Docker Compose installed.

  • Privileges: Root or sudo access is required for directory creation and service management.

  • Ports:

  • 80 (HTTP) for web traffic and SSL certificate challenges.

  • 443 (HTTPS) for secure web traffic.

  • 9000 (Internal) for FastCGI communication between Nginx and WordPress.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain template:

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

File and Directory Structure

The deployment utilizes the following directory structure for configuration and data persistence:

  • /root/wordpress/: Contains the Docker Compose orchestration file (compose.yml).

  • /data/nginx/: Stores Nginx environment files and user-defined configuration files.

  • /data/nginx/user_conf.d/: Location of the site-specific Nginx server blocks.

  • /data/wordpress/: Persistent storage for WordPress website files.

Application installation process

The application is deployed using Docker Compose to orchestrate multiple services. The deployment follows these steps:

  1. Environment Preparation: Necessary directories are created with specific permissions (0640 for system data and 0755 for web content).

  2. Configuration Generation:

  3. An Nginx environment file is placed in /data/nginx/.

  4. A site-specific configuration file is generated in /data/nginx/user_conf.d/ based on the server's FQDN.

  5. A compose.yml file is generated in /root/wordpress/.

  6. Service Orchestration: The application is started using the following command within the deployment directory:

    docker compose up -d
    

Access Rights and Security

  • Directory Permissions: Data directories are owned by root to ensure security, with specific modes applied to prevent unauthorized access.

  • Network Isolation: The WordPress service is bound to 127.0.0.1:9000, ensuring it is only accessible via the local Nginx proxy and not directly from the external network.

  • SSL/TLS: SSL certificates are managed via Certbot within a dedicated container, with certificates stored in a Docker volume (nginx_secrets).

Databases

The application uses MariaDB as the database engine.

Parameter Value
Database Name wordpress
Database User wordpress
Storage Location Managed via Docker volume mariadb_data

Docker Containers and Their Deployment

The deployment consists of three main containers:

MariaDB

  • Image: docker.io/bitnami/mariadb:latest

  • Environment Variables:

  • MARIADB_USER=wordpress

  • MARIADB_DATABASE=wordpress

  • MARIADB_PASSWORD: Set during installation

  • MARIADB_ROOT_PASSWORD: Set during installation

  • Volumes: mariadb_data:/bitnami/mariadb

  • Restart Policy: unless-stopped

WordPress

  • Image: docker.io/wordpress:php8.3-fpm

  • Ports: 127.0.0.1:9000:9000

  • Volumes: /data/wordpress:/var/www/html

  • Environment Variables:

  • MYSQL_ROOT_PASSWORD: Set during installation

  • WORDPRESS_DB_PASSWORD: Set during installation

  • WORDPRESS_DB_HOST=mariadb

  • WORDPRESS_DB_USER=wordpress

  • WORDPRESS_DB_NAME=wordpress

  • Restart Policy: unless-stopped

Nginx (with Certbot)

  • Image: jonasal/nginx-certbot:latest

  • Network Mode: host

  • Environment Variables:

  • [email protected]

  • Volumes:

  • nginx_secrets:/etc/letsencrypt

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

  • /data/wordpress:/var/www/html

  • Restart Policy: unless-stopped

Application Update Instructions

To update the WordPress application, navigate to the deployment directory and pull the latest images before restarting the services:

cd /root/wordpress
docker compose pull && docker compose up -d

Location of configuration files and data

Component Path
Docker Compose File /root/wordpress/compose.yml
Nginx Configuration /data/nginx/user_conf.d/{prefix}{Server_ID_from_Invapi}.hostkey.in.conf
WordPress Files /data/wordpress
MariaDB Data Managed via Docker volume mariadb_data

Available ports for connection

  • HTTP: Port 80 (via Nginx)

  • HTTPS: Port 443 (via Nginx)

Starting and Stopping the application

The application is managed using Docker Compose. Use these commands from /root/wordpress:

To start the application:

docker compose up -d

To stop the application:

docker compose down

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