WordPress VPS template on HostAfrica
WordPress implementation on HostAfrica
Russell
Last Update 2 months ago
Self-Hosted WordPress gives you complete control of your website on a dedicated VPS environment. Unlike shared hosting, your site runs on isolated resources with a dedicated IP for improved performance, security, and reliability. With full root access, you can customize your server, install additional tools, and scale as needed perfect for business sites, developers, agencies, and anyone who wants a powerful, flexible WordPress setup.
Business Websites: Run professional corporate websites with full control over performance, security, and customization without the limitations of shared hosting.
E-commerce Sites: Host WooCommerce stores with dedicated resources ensuring fast page loads, secure transactions, and the ability to handle traffic spikes.
Development & Staging: Create isolated development environments for testing themes, plugins, and updates before deploying to production sites.
Agency Client Sites: Manage multiple client WordPress installations with full server access, custom configurations, and white-label control panels.
High-Traffic Blogs: Run content-heavy blogs and news sites with optimized caching, CDN integration, and resources dedicated solely to your site.
Membership Sites: Host subscription-based platforms with secure login systems, protected content, and reliable uptime for paying members.
Implementation on HostAfrica:
Our Self-Hosted WordPress implementation includes CloudPanel, a modern server control panel that makes managing WordPress simple and efficient. The setup provides:
Dual Admin Interfaces: CloudPanel for server management (cp.yourdomain.com) and WordPress admin for content management (yourdomain.com/wp-admin)
Automatic SSL: Let's Encrypt certificates automatically installed and renewed for both domains
WP-CLI Integration: Command-line tool for advanced WordPress management
Single Sign-On: One set of credentials (admin username) for both CloudPanel and WordPress
Automated Deployment: Complete setup in 3-5 minutes via Cloud-init automation
| Component | Description |
| Ubuntu 24.04 | Long-term support base operating system |
| CloudPanel | Web-based server control panel for site, database, and SSL management |
| WordPress | Latest WordPress version with auto-installation |
| NGINX | High-performance web server with HTTP/2 support |
| PHP-FPM 8.4 | Latest PHP version optimized for WordPress |
| MySQL 8.4 | Database server with WordPress-optimized configuration |
| Let's Encrypt | Free automatic SSL certificate provisioning |
| Cloud-init | Automated provisioning system |
| UFW Firewall | Pre-configured with secure port rules |

WordPress Template Implementation
The deployment is fully automated using Cloud-init provisioning. All configuration happens during the first boot, creating a production-ready WordPress environment without manual intervention.
WordPress Files: /home/wordpress/htdocs/{domain}/
CloudPanel Config: /home/clp/
Cloud-init Logs: /var/log/cloud-init-output.log
NGINX Config: /etc/nginx/sites-enabled/
| Service | URL | Port |
| WordPress Site | https://{domain} | 443 |
| WordPress Admin | https://{domain}/wp-admin | 443 |
| CloudPanel GUI | https://cp.{domain} | 443 |
| CloudPanel Direct | https://{server_ip}:8443 | 8443 |
| SSH Access | {server_ip} | 22 |
Environment Variables:
Cloud-init uses variables passed from the provisioning system to configure the WordPress installation:
| Variable | Description | Example |
| {$domain} | Primary domain name | example-wordpress-wordpress-wordpress.hcloud.app |
| {$passwordHash} | Hashed root password | Auto-generated |
| {$customfields.app_login} | Admin username | admin |
| {$customfields.app_pass} | Admin password | Auto-generated alphanumeric |
Admin Username: admin (used for both CloudPanel and WordPress)
Admin Password: Auto-generated 16-character alphanumeric password
Database Name: wordpress
Database User: wordpress
Database Password: Auto-generated during deployment
PHP Version: 8.4
CloudPanel Domain: cp.{domain}
Cloud-init Functionality:
Cloud-init automates the complete WordPress deployment process during the first VM boot. The script:
Sets the hostname and root password
Waits for CloudPanel to be ready (30 seconds)
Creates CloudPanel admin user with provided credentials
Configures reverse proxy for CloudPanel access via custom domain
Installs SSL certificate for CloudPanel domain
Creates PHP 8.4 site for the main domain
Creates MySQL database with secure credentials
Downloads and installs latest WordPress
Configures WordPress with database connection
Completes WordPress installation with admin user
Sets correct file permissions
Installs SSL certificate for WordPress domain
Total Deployment Time: 3-5 minutes from provisioning to production-ready
The CloudPanel reverse proxy is created to allow access to the CloudPanel web interface via a custom domain name instead of the default IP address and port (usually https://server-ip:8443). This makes it easier for users to remember and access the panel.
Additionally, the reverse proxy handles SSL termination, allowing secure HTTPS connections with a valid SSL certificate (e.g., via Let’s Encrypt), without requiring CloudPanel itself to manage certificates directly. It also provides flexibility for managing traffic, improving security, and allowing CloudPanel to coexist with other services on the same server.
How to Access WordPress & CloudPanel:
After deployment, access your WordPress admin dashboard:
URL: https://{domain}/wp-adminUsername: admin (or custom value from app_login field)Password: Auto-generated (provided in provisioning confirmation)

CloudPanel Access
Manage your server, databases, and SSL certificates:
Primary URL: https://cp.{domain}
Fallback URL: https://{server_ip}:8443
Username: admin (same as WordPress)
Password: Same password as WordPress

Login to CloudPanel Admin Area.
Go to Settings.
Ensure you create an A record for your new domain (e.g., cp.domain.com) in your DNS manager, pointing to the WordPress VPS IP.
Add the domain in CloudPanel and save.
Your CloudPanel URL should now be cp.domain.com.
How to Change WordPress Site Domain/URL
Ensure you create an A record for your new domain (e.g., domain.com) in your DNS manager, pointing to the WordPress VPS IP.
Login to the CloudPanel GUI.
Navigate to Sites → Your Domain → Manage
Navigate to the vhost settings
Change the server_name for both ports 80 and 8080 to your new domain.

Click Save.
At this point, the new domain should load without SSL.
Run via Terminal:
Then Reload nginx:
Administrators can reset both CloudPanel and WordPress passwords simultaneously:
Access your server via SSH
Execute password reset commands:
The server comes with UFW (Uncomplicated Firewall) pre-configured with secure rules:
Cause: Cloud-init script failed to run or SSL installation failed
Solution:
Cause: Firewall blocking ports or service not running
Solution:
3. WordPress Shows Database Connection Error
Cause: Database credentials mismatch
Solution:
4. SSL Certificate Installation Failed
Cause: DNS records not propagated or ports 80/443 blocked
Solution:
Verify DNS A record points to server IP
Check ports are open: ufw status
Wait 5-10 minutes for DNS propagation
Retry SSL installation via CloudPanel
5. Password Contains Special Characters Not Accepted
Cause: CloudPanel doesn't accept certain special characters
Solution: Use alphanumeric passwords only (A-Z, a-z, 0-9)
6. File Permission Issues
Cause: Incorrect ownership of WordPress files
Solution:
Change default admin username after first login
Use strong alphanumeric passwords (16+ characters)
Keep WordPress, themes, and plugins updated
Install a security plugin (Wordfence, Sucuri)
Enable two-factor authentication
Regular database backups via CloudPanel
Install a caching plugin (WP Super Cache, W3 Total Cache)
Use a CDN for static assets
Optimize images before uploading
Remove unused themes and plugins
Enable CloudPanel's built-in caching features
Schedule regular backups (daily recommended)
Monitor disk space usage
Review CloudPanelgs periodically
Test updates on staging before production
Keep SSH keys secure and rotate regularly
Additional Resources:
WordPress Documentation: Documentation
CloudPanel Documentation: Introduction | CloudPanel | Documentation
WP-CLI Handbook: Handbook
NGINX Optimization: F5 Blog | NGINX
Let's Encrypt: Documentation
