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.inzone 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.ymlfile for service orchestration.
- Contains the
-
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:
-
WooCommerce Plugin: Version
8.7.0is downloaded from the official WordPress repository, extracted, and placed into the plugins directory. -
WordPress Core: Hosted within the
docker.io/wordpress:php8.2-fpmcontainer. -
Database: Hosted within the
bitnami/mariadb:latestcontainer. -
Reverse Proxy: Hosted within the
jonasal/nginx-certbot:latestcontainer, 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-certbotimage.-
Certificates are stored in
/etc/letsencrypt/live/. -
The server listens on port
443with SSL enabled.
-
-
Routing:
-
Static files and PHP scripts are served from
/var/www/htmlinside the container (mapped to/data/wordpresson 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:
0640for the directory itself;0644for thecompose.ymlfile.
-
-
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.1on 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:
-
Stop Services:
-
View Logs:
-
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.