
1. Introduction
CloudPanel is a modern server control panel designed specifically for PHP applications. It provides an intuitive web interface for managing web servers, making it easier to deploy and maintain PHP applications. This comprehensive guide will walk you through the installation and configuration process, covering everything from basic setup to advanced features.
2. System Requirements
Before beginning the installation, ensure your system meets these minimum requirements:
- Operating System: Ubuntu 20.04 LTS or 22.04 LTS (recommended)
- RAM: Minimum 1GB (2GB or more recommended)
- CPU: 1 core (2 cores or more recommended)
- Storage: 20GB minimum
- Network: Active internet connection
- Clean server installation (no other control panels or web servers installed)
3. Prerequisites
Before installing CloudPanel, you need to prepare your system. Here’s what you need to do:
Update system packages
First, update your system’s package list and upgrade existing packages:
$ sudo apt update
$ sudo apt upgrade -y
Set Correct Timezone
Ensure your server’s timezone is correctly set:
$ sudo timedatectl set-timezone UTC
Replace UTC with your preferred timezone if needed.
Install Essential Packages
Install required system utilities:
$ sudo apt install -y curl wget git unzip net-tools
4. Installation process
Download the installation script
CloudPanel provides an automated installation script. Download it using:
$ curl -sSL https://installer.cloudpanel.io/ce/v2/install.sh -o install.sh
Verify the Script (Optional but Recommended)
Check the script’s integrity:
$ sha256sum install.sh
Make the Script Executable
$ chmod +x install.sh
Run the Installation Script
$ sudo ./install.sh
The installation process will take approximately 5-15 minutes, depending on your server’s specifications and internet connection speed. The script will:
- Install system dependencies
- Configure the firewall
- Install and configure Nginx
- Install PHP versions
- Install MySQL
- Set up the CloudPanel interface
During installation, you’ll see various progress indicators and may be prompted for input occasionally.
5. Initial Setup and Configuration
Accessing the Control Panel
Once installation completes, you’ll receive the following information:
- CloudPanel URL (https://your-server-ip:8443)
- Admin credentials
Access the panel using these credentials. On first login, you’ll be prompted to:
- Change the admin password
- Configure email settings
- Set up backup preferences
Email Configuration
To configure email notifications:
- Navigate to Settings → Email
- Choose your email provider:
- SMTP
- Amazon SES
- Mailgun
For SMTP configuration:
$ sudo clp-email-config --smtp-host=smtp.gmail.com \
--smtp-port=587 \
--smtp-encryption=tls \
[email protected] \
--smtp-password='your-password'
6. Domain Management
Adding a New Domain
- Click “Sites” in the left menu
- Click “Add Site”
- Enter domain details:
- Domain name
- PHP version
- Document root
- Application type
Configuring Domain Settings
For each domain, you can configure:
$ sudo clp-domain-config --domain=example.com \
--php-version=8.1 \
--document-root=/home/example.com/public
Setting Up Subdomains
To create a subdomain:
- Navigate to the domain settings
- Click “Add Subdomain”
- Configure subdomain settings:
- Subdomain name
- Document root
- PHP version (can differ from main domain)
7. Database Management
Creating a New Database
Via command line:
$ sudo clp-db-create --name=mydb \
--user=dbuser \
--password='secure_password'
Or through the web interface:
- Navigate to Databases
- Click “Add Database”
- Fill in the required information:
- Database name
- Username
- Password
- Host access permissions
Database Backup
To backup a database:
$ sudo clp-backup-db --database=mydb --output=/backup/mydb.sql
Database Restoration
To restore a database:
$ sudo clp-restore-db --database=mydb --file=/backup/mydb.sql
8. SSL Certificate Configuration
Let’s Encrypt Integration
CloudPanel includes built-in Let’s Encrypt integration. To secure a domain:
- Navigate to Sites → Your Domain → SSL
- Click “Install Let’s Encrypt Certificate”
- Verify domain ownership
- Wait for certificate installation
Manual SSL Certificate Installation
To install a custom SSL certificate:
$ sudo clp-ssl-install --domain=example.com \
--cert=/path/to/certificate.crt \
--key=/path/to/private.key \
--chain=/path/to/chain.crt
9. PHP Configuration
Managing PHP Versions
CloudPanel supports multiple PHP versions. To install a new version:
$ sudo clp-php-install --version=8.2
PHP Configuration Options
Modify PHP settings through the web interface:
- Navigate to Sites → Your Domain → PHP
- Adjust settings:
- Memory limit
- Max execution time
- Upload size limits
- Error reporting
Or via command line:
$ sudo clp-php-config --version=8.1 \
--memory-limit=256M \
--max-execution-time=300
Installing PHP Extensions
$ sudo clp-php-ext-install --version=8.1 --extension=imagick
10. Server Optimization
Nginx Configuration
Optimize Nginx settings:
$ sudo nano /etc/nginx/nginx.conf
Key settings to consider:
worker_processes auto;
worker_connections 1024;
keepalive_timeout 65;
client_max_body_size 64M;
PHP-FPM Optimization
Adjust PHP-FPM pool settings:
$ sudo nano /etc/php/8.1/fpm/pool.d/www.conf
Recommended settings:
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
MySQL Optimization
Optimize MySQL performance:
$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Key settings:
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
max_connections = 150
11. Backup and Restore
Configuring Automated Backups
Set up daily backups:
$ sudo clp-backup-config --schedule=daily \
--retention=7 \
--type=full \
--destination=/backup
Manual Backup
Create a full system backup:
$ sudo clp-backup-create --type=full --destination=/backup
Backup Restoration
Restore from backup:
$ sudo clp-backup-restore --file=/backup/backup-2024-01-08.tar.gz
12. Security Best Practices
Firewall Configuration
Configure UFW firewall:
$ sudo ufw allow 22/tcp
$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
$ sudo ufw allow 8443/tcp
$ sudo ufw enable
Secure SSH Access
Modify SSH configuration:
$ sudo nano /etc/ssh/sshd_config
Recommended settings:
PermitRootLogin no
PasswordAuthentication no
Port 2222
Regular Security Updates
Set up automatic security updates:
$ sudo apt install unattended-upgrades
$ sudo dpkg-reconfigure --priority=low unattended-upgrades
13. Troubleshooting Common Issues
Log File Locations
Important log files:
- Nginx:
/var/log/nginx/
- PHP-FPM:
/var/log/php/
- MySQL:
/var/log/mysql/
- CloudPanel:
/var/log/cloudpanel/
Common Commands for Troubleshooting
Check service status:
$ sudo systemctl status nginx
$ sudo systemctl status php8.1-fpm
$ sudo systemctl status mysql
View real-time logs:
$ sudo tail -f /var/log/nginx/error.log
$ sudo tail -f /var/log/php/8.1/error.log
14. Advanced Configuration
Custom Nginx Configuration
Add custom Nginx configuration:
$ sudo nano /etc/nginx/conf.d/custom.conf
PHP Custom Configuration
Create PHP custom configuration:
$ sudo nano /etc/php/8.1/fpm/conf.d/custom.ini
Database Replication Setup
Configure MySQL replication:
$ sudo clp-mysql-replication --master-host=master.example.com \
--master-user=repl \
--master-password='secure_password'
15. Maintenance and Updates
Updating CloudPanel
Update CloudPanel to the latest version:
$ sudo clp-update
System Maintenance
Regular maintenance tasks:
$ sudo clp-maintenance --clean-logs
$ sudo clp-maintenance --optimize-databases
$ sudo clp-maintenance --check-services
Monitoring System Resources
Install monitoring tools:
$ sudo apt install -y htop iotop
Monitor system resources:
$ htop
$ iotop
Conclusion
CloudPanel provides a robust and user-friendly interface for managing web servers and PHP applications. This guide covers the essential aspects of installation and configuration, but CloudPanel offers many more features and capabilities. Regular updates and maintenance will ensure optimal performance and security of your server.