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 server with Docker installed.

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

  • Domain: A valid domain managed under the hostkey.in zone.

  • Ports:

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

  • Port 443 (HTTPS) for secure web traffic.

FQDN of the final panel on the hostkey.in domain

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

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

File and Directory Structure

The following directories are created on the host to manage configuration, data, and certificates:

  • /data/nginx/: Contains Nginx configurations and environment files.

  • /data/nginx/user_conf.d/: Stores custom Nginx server blocks.

  • /data/wordpress/: The persistent storage directory for WordPress website files.

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

Application installation process

The application is deployed using Docker Compose to manage the web server, database, and PHP processing unit. The installation follows these steps:

  1. Environment Setup: Necessary directories are created with specific ownership (root) and permissions.

  2. Configuration Generation: Configuration files for Nginx and the Docker orchestration layer are generated in /data/nginx/ and /root/wordpress/.

  3. Container Orchestration: The application is started using docker compose up -d from within the /root/wordpress/ directory.

The deployment utilizes the following images:

  • bitnami/mariadb:latest for the database engine.

  • wordpress:php8.2-fpm for the WordPress core and PHP processing.

  • jonasal/nginx-certbot:latest for Nginx web serving and automated SSL management via Certbot.

Access Rights and Security

  • File Permissions: Configuration files are set to 0644 (read/write for owner, read-only for others), and directories are set to 0755.

  • Network Isolation: The WordPress container is bound to the local loopback interface (127.0.0.1:9000) to prevent direct external access to the PHP-FPM service, ensuring it only communicates with the Nginx proxy.

  • SSL/TLS: Secure connections are enforced via SSL certificates managed by Certbot.

Databases

The application uses a MariaDB database container for data storage.

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

Docker Containers and Their Deployment

The application consists of three primary containers:

MariaDB

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

  • Restart Policy: unless-stopped

  • Volumes: mariadb_data:/bitnami/mariadb

  • Environment Variables:

  • MARIADB_USER: wordpress

  • MARIADB_DATABASE: wordpress

  • MARIADB_PASSWORD: Set during installation

  • MARIADB_ROOT_PASSWORD: Set during installation

WordPress

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

  • Restart Policy: unless-stopped

  • Ports: 127.0.0.1:9000:9000

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

  • Environment Variables:

  • WORDPRESS_DB_HOST: mariadb

  • WORDPRESS_DB_NAME: wordpress

  • WORDPRESS_DB_USER: wordpress

  • WORDPRESS_DB_PASSWORD: Set during installation

Nginx (Proxy & SSL)

  • Image: jonasal/nginx-certbot:latest

  • Restart Policy: unless-stopped

  • Network Mode: host

  • Volumes:

  • nginx_secrets:/etc/letsencrypt

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

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

  • Environment Variables:

  • CERTBOT_EMAIL: [email protected]

Application Update Instructions

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

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

Location of configuration files and data

  • Nginx Configuration: /data/nginx/user_conf.d/

  • WordPress Files: /data/wordpress/

  • Docker Orchestration: /root/wordpress/compose.yml

Available ports for connection

  • HTTP (SSL Challenge): Port 80

  • HTTPS: Port 443

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