Skip to content

Deployment Overview of WordPress with WooCommerce on Server

Prerequisites and Basic Requirements

  • Operating System: Debian-based Linux distribution.

  • Privileges: Root access is required for installation and configuration.

  • Domain: A subdomain under the hostkey.in zone is configured automatically.

  • Ports:

    • Port 443 (HTTPS) for external web traffic.

    • Port 9000 (localhost) for internal PHP-FPM communication.

  • Software: Docker Engine and Docker Compose must be operational.

FQDN of the Final Panel

The application is accessible via the following Fully Qualified Domain Name (FQDN): wp<Server ID>.hostkey.in:443

Replace <Server ID> with the specific server identifier assigned to the instance.

File and Directory Structure

The system organizes configuration, data, and code into the following paths:

  • Application Data: /data/wordpress

    • Contains the WordPress core files and plugin directory.

    • Plugins are located at /data/wordpress/wp-content/plugins/.

  • Docker Configuration: /root/wordpress

    • Contains the compose.yml file for service orchestration.
  • Nginx Configuration: /data/nginx

    • User-specific server blocks: /data/nginx/user_conf.d/.

    • Environment variables: /data/nginx/nginx-certbot.env.

    • SSL Certificates (managed by Let's Encrypt): /etc/letsencrypt/.

Application Installation Process

The application is deployed using Docker Compose. The process involves the following versioned components:

  1. WooCommerce Plugin: Version 8.7.0 is downloaded from the official WordPress repository, extracted, and placed into the plugins directory.

  2. WordPress Core: Hosted within the docker.io/wordpress:php8.2-fpm container.

  3. Database: Hosted within the bitnami/mariadb:latest container.

  4. Reverse Proxy: Hosted within the jonasal/nginx-certbot:latest container, handling SSL termination and routing.

The deployment initializes the directory structure, places the WooCommerce plugin, generates the Docker Compose configuration, and starts the services.

Docker Containers and Their Deployment

The environment runs three primary containers defined in /root/wordpress/compose.yml.

Service Name Docker Image Purpose
mariadb bitnami/mariadb:latest Hosts the application database.
wordpress docker.io/wordpress:php8.2-fpm Runs the PHP application logic.
nginx jonasal/nginx-certbot:latest Acts as the web server, reverse proxy, and SSL manager.

The nginx container uses network_mode: host to bind directly to the host's network stack. The wordpress container binds PHP-FPM to 127.0.0.1:9000 on the host.

Databases

The database is a MariaDB instance running inside a Docker container.

  • Connection Host: mariadb (internal container name).

  • Database Name: wordpress.

  • Database User: wordpress.

  • Storage: Data is persisted in a named Docker volume labeled mariadb_data.

  • Credentials: The root password and application password are managed via environment variables within the Docker Compose configuration.

Proxy Servers

Nginx is utilized as the reverse proxy and SSL terminator.

  • Configuration Location: /data/nginx/user_conf.d/wp<Server ID>.hostkey.in.conf.

  • SSL/TLS: Managed automatically by the nginx-certbot image.

    • Certificates are stored in /etc/letsencrypt/live/.

    • The server listens on port 443 with SSL enabled.

  • Routing:

    • Static files and PHP scripts are served from /var/www/html inside the container (mapped to /data/wordpress on the host).

    • PHP requests are proxied to the local PHP-FPM service at localhost:9000.

  • Index File: index.php.

Permission Settings

File and directory permissions are configured as follows during the setup:

  • Application Data Directory (/data/wordpress):

    • Owner: 33 (www-data).

    • Group: 33 (www-data).

    • Mode: 0755.

  • Docker Config Directory (/root/wordpress):

    • Owner: root.

    • Group: root.

    • Mode: 0640 for the directory itself; 0644 for the compose.yml file.

  • Nginx Config Files:

    • Owner: root.

    • Group: root.

    • Mode: 0644.

Available Ports for Connection

  • Port 443: The primary entry point for the application via HTTPS.

  • Port 9000: Internal only. Binds to 127.0.0.1 on the host and connects the Nginx container to the WordPress PHP-FPM container.

Starting, Stopping, and Updating

Service management is performed using Docker Compose within the configuration directory.

  • Start Services:

    cd /root/wordpress
    docker compose up -d
    

  • Stop Services:

    cd /root/wordpress
    docker compose down
    

  • View Logs:

    docker compose logs -f
    

  • Update Configuration: To apply changes to the configuration files or pull new images, stop the services, modify the configuration if necessary, and run the start command again.

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