Oke! Kita bisa buat WHM custom yang lebih lengkap sesuai kebutuhanmu. Berikut adalah fitur tambahan yang bisa kita tambahkan dan bagaimana cara mengimplementasikannya:
Fitur Tambahan untuk WHM Custom
1️⃣ Auto SSL (Let's Encrypt)
🔹 Setiap domain yang ditambahkan akan otomatis mendapatkan sertifikat SSL gratis.
🔹 Menggunakan Certbot untuk generate dan renew SSL secara otomatis.
📌 Script Auto SSL (Let's Encrypt)
#!/bin/bash
domain=$1
certbot --apache -d $domain --non-interactive --agree-tos -m admin@$domain
systemctl reload apache2
echo "SSL untuk $domain telah aktif!"
🔧 Integrasi ke PHP:
Setelah user menambahkan domain, script ini bisa dipanggil via exec() di PHP.
2️⃣ Auto Backup Hosting (Daily/Weekly)
🔹 Setiap akun hosting bisa di-backup secara otomatis.
🔹 Backup akan tersimpan di /backup/username/ atau dikirim ke Google Drive/SFTP.
📌 Script Backup (Cron Job)
#!/bin/bash
username=$1
backup_dir="/backup/$username"
mkdir -p $backup_dir
tar -czvf $backup_dir/backup-$(date +%Y-%m-%d).tar.gz /var/www/$username
echo "Backup selesai!"
🔧 Tambahkan ke Cron Job untuk menjalankan otomatis:
0 2 * * * /path/to/backup-script.sh username
🔹 Bisa buat tombol backup manual di dashboard PHP.
3️⃣ Manajemen Database MySQL (Buat & Hapus)
🔹 Setiap akun bisa membuat database sendiri lewat dashboard.
📌 Script Tambah Database
#!/bin/bash
dbname=$1
dbuser=$2
dbpass=$3
mysql -e "CREATE DATABASE $dbname;"
mysql -e "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpass';"
mysql -e "GRANT ALL PRIVILEGES ON $dbname.* TO '$dbuser'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
echo "Database $dbname berhasil dibuat!"
🔧 Integrasi ke PHP:
Gunakan exec("bash script.sh dbname dbuser dbpass") untuk menjalankan script ini.
4️⃣ Web-Based File Manager
🔹 User bisa upload, download, edit file langsung di dashboard.
🔹 Bisa pakai Monsta FTP atau Tiny File Manager (gratis).
📌 Langkah Integrasi
- Download Tiny File Manager → GitHub
- Ekstrak di
/var/www/filemanager/ - Edit
config.phpuntuk login user - Akses di
domain.com/filemanager/
🔧 Bisa langsung dipakai tanpa coding tambahan!
5️⃣ API Custom untuk Integrasi Pembayaran
🔹 Bisa pakai Tripay, Midtrans, atau PayPal untuk otomatisasi pembayaran hosting.
🔹 Setelah bayar, sistem akan auto perpanjang akun hosting.
📌 Contoh API Tripay untuk Cek Pembayaran
$apiKey = "API_KEY_KAMU";
$invoice = "INV12345";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://tripay.co.id/api/transaction/detail?invoice=$invoice");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $apiKey"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
echo "Pembayaran sukses, akun diperpanjang!";
}
🔧 Integrasi ke Dashboard:
- Tambahkan form pembayaran di PHP.
- Setelah user bayar, sistem cek otomatis dan update masa aktif akun.
6️⃣ API Custom untuk Reseller Hosting
🔹 Buat sistem reseller hosting agar orang lain bisa menjual paket hosting dari kamu.
🔹 Setiap reseller bisa buat akun hosting untuk pelanggannya.
📌 Contoh API Buat Akun Hosting via Reseller
$apiKey = "API_RESELLER_KAMU";
$username = "newuser";
$password = "password123";
$domain = "newdomain.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://whm.yourdomain.com/api/create_account?user=$username&pass=$password&domain=$domain&key=$apiKey");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
🔧 Reseller bisa mengakses API ini untuk membuat akun hosting.
Bagaimana Cara Implementasinya?
📌 Jika kamu ingin WHM Custom yang lebih simpel:
- Gunakan PHP + MySQL + Shell Script untuk auto-manage hosting.
- Tambahkan fitur dasar seperti akun hosting, SSL, database, dan pembayaran.
📌 Jika ingin sistem lebih canggih:
- Gunakan Laravel untuk backend yang lebih aman.
- Pakai Vue.js atau React.js untuk UI modern.
- Integrasi API untuk reseller hosting dan otomatisasi penuh.