🚀 Panduan Lengkap Hostiqo
Panel Pengurusan Server & Auto-Deploy
Kursus: Deploy Aplikasi Web ke Cloud Server
Pengajar: Ahmad Saiful Bahri
Kemaskini: Januari 2026
📋 Objektif Pembelajaran
Selepas mengikuti kursus ini, anda akan dapat:
- ✅ Menyediakan cloud server dengan panel Hostiqo
- ✅ Menyediakan aplikasi React/Static untuk production
- ✅ Melakukan deployment aplikasi ke server dengan auto-deploy
- ✅ Mengkonfigurasi domain dan SSL certificate (HTTPS)
- ✅ Menyelesaikan masalah teknikal yang biasa berlaku
📦 Keperluan Sebelum Memulakan
Akaun yang Diperlukan
| Akaun | Kegunaan | Pautan |
|---|---|---|
| Cloud Provider | Server hosting | Lihat pilihan di bawah |
| GitHub | Repository kod | github.com |
| Domain | Alamat website | Cloudflare / Namecheap / etc |
Pilihan Cloud Provider
Pilihan 1 - DigitalOcean (Antarabangsa)
- Pautan: https://m.do.co/c/9709748ce8a4
- Lokasi server: Singapore
- Harga bermula: ~$6/bulan (USD)
- Kelebihan: Interface mesra pengguna, dokumentasi lengkap
Pilihan 2 - GB Network Hosting (Malaysia)
- Pautan: https://secure.gbnetwork.com/aff.php?aff=1276
- Lokasi server: Malaysia
- Harga bermula: ~RM20/bulan
- Kelebihan: Server tempatan, support dalam Bahasa Malaysia
Spesifikasi Server Minimum
| Item | Minimum | Disyorkan |
|---|---|---|
| RAM | 1 GB | 2 GB |
| CPU | 1 vCPU | 2 vCPU |
| Storage | 25 GB SSD | 50 GB SSD |
| OS | Ubuntu 24.04 LTS | Ubuntu 24.04 LTS |
BAHAGIAN A Penyediaan Server
Langkah 1: Cipta Virtual Server
Untuk DigitalOcean:
- Login ke DigitalOcean
- Klik Create → Droplets
- Pilih konfigurasi berikut:
- Region: Singapore
- Image: Ubuntu 24.04 (LTS) x64
- Size: Basic → Regular → $6/month
- Authentication: Password
- Hostname:
class-server(atau nama pilihan anda) - Klik Create Droplet
- Catatkan IP Address (contoh:
146.190.99.138)
Untuk GB Network:
- Login ke GB Network
- Pilih Cloud VPS → Pakej pilihan anda
- Pilih konfigurasi:
- OS: Ubuntu 24.04 LTS
- Location: Malaysia
- Lengkapkan pembayaran
- Catatkan IP Address dari email confirmation
Langkah 2: Konfigurasi DNS
Sebelum memasang Hostiqo, domain perlu diarahkan ke IP server.
Di Cloudflare / DNS Provider:
Pilihan 1 - Wildcard (Disyorkan):
Type: A
Name: *
Content: [IP_SERVER_ANDA]
TTL: Auto
Dengan wildcard, semua subdomain akan berfungsi secara automatik.
Pilihan 2 - Subdomain Tertentu:
Type: A
Name: panel
Content: [IP_SERVER_ANDA]
TTL: Auto
Langkah 3: Login ke Server
Buka terminal (Mac/Linux/WSL) dan jalankan arahan SSH:
ssh root@[IP_SERVER_ANDA]
Contoh:
ssh root@146.190.99.138
Jika mendapat soalan fingerprint, taipkan yes:
Are you sure you want to continue connecting? yes
Masukkan password dan anda akan melihat prompt:
root@class-server:~#
Langkah 4: Pre-Update System (WAJIB)
apt-get update -y && apt-get upgrade -y
Mengapa Langkah Ini Wajib?
Installer Hostiqo menyembunyikan semua output untuk paparan yang lebih kemas. Namun, jika terdapat prompt interaktif (contoh: "keep existing config?"), anda tidak akan dapat melihatnya. Ini akan menyebabkan installer tersekat tanpa sebarang mesej error.
Jika Mendapat Prompt Konfigurasi:
Configuration file '/etc/xxxxx'
==> Modified (by you or by a script) since installation.
What would you like to do about it?
Jawapan: Tekan Enter untuk mengekalkan konfigurasi default.
Jika Mendapat Error "Lock":
E: Could not get lock /var/lib/dpkg/lock-frontend
Penyelesaian: Tunggu 2-3 minit kerana terdapat proses apt lain yang sedang berjalan, kemudian cuba semula.
Langkah 5: Pasang Hostiqo
Jalankan arahan berikut untuk memulakan pemasangan:
curl -fsSL https://raw.githubusercontent.com/hymns/hostiqo/master/scripts/install.sh | bash
Panduan Menjawab Soalan Installer:
| Soalan | Jawapan |
|---|---|
| Continue with installation? (y/n) | Taip y → Enter |
| Installation path | ⚠️ Tekan Enter sahaja! Jangan taip apa-apa! |
| Setup database automatically? | y |
| Database name | Tekan Enter (gunakan default) |
| Database user | Tekan Enter (gunakan default) |
| Database password | Taip password yang kukuh |
| Create admin user? | y |
| Admin name | Nama anda |
| Admin email | Email anda (untuk login panel) |
| Admin password | Password untuk login panel |
| Domain name | panel.yourdomain.com |
| Include www subdomain? | n |
| Setup SSL certificate? | y |
| Email for SSL | Email anda |
Output Jangkaan Selepas Selesai:
==========================================
Installation Complete! 🎉
==========================================
✓ Hostiqo has been installed successfully!
→ Access your panel at: https://panel.yourdomain.com
Langkah 6: Akses Panel Hostiqo
- Buka web browser
- Layari
https://panel.yourdomain.com - Login menggunakan email dan password admin yang telah dicipta
BAHAGIAN B Menyediakan Aplikasi dari Google AI Studio
Langkah 1: Generate Kod yang Production-Ready
Apabila meminta Google AI Studio menjana aplikasi React, sertakan arahan khusus supaya kod yang dihasilkan sedia untuk deployment.
Contoh Prompt untuk AI Studio:
Create a [DESCRIPTION OF YOUR APP] using React with Vite.
IMPORTANT - Please ensure the code is production-ready:
1. Use Vite as the build tool with proper vite.config.js
2. Include a complete package.json with these scripts:
- "dev": "vite"
- "build": "vite build"
- "preview": "vite preview"
3. Ensure all assets (images, fonts) use relative paths
4. Do not use environment variables that only work in development
5. Make sure the app works when served as static files from /dist folder
6. Include proper index.html in the root folder
7. All API calls should use full URLs, not relative paths
Contoh Prompt Lengkap:
Create a weather forecast app using React with Vite that shows current weather and 5-day forecast.
IMPORTANT - Please ensure the code is production-ready:
1. Use Vite as the build tool with proper vite.config.js
2. Include a complete package.json with these scripts:
- "dev": "vite"
- "build": "vite build"
- "preview": "vite preview"
3. Ensure all assets use relative paths
4. The app must work when served as static files from /dist folder
5. Use Tailwind CSS for styling
6. Include proper error handling for API calls
Struktur Fail yang Diperlukan:
Pastikan projek anda mempunyai struktur berikut:
project/
├── index.html ← Entry point
├── package.json ← Dependencies & scripts
├── vite.config.js ← Vite configuration
├── src/
│ ├── main.jsx ← React entry
│ ├── App.jsx ← Main component
│ └── components/ ← Other components
└── public/ ← Static assets
Semak package.json:
Pastikan package.json mempunyai scripts berikut:
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}
Langkah 2: Muat Turun dan Sediakan Projek
- Di Google AI Studio, klik Download atau Export untuk memuat turun projek
- Extract fail zip ke folder pilihan anda
- Buka terminal di dalam folder tersebut
Test Build Secara Lokal (Pilihan):
npm install
npm run build
npm run preview
Jika tiada error, projek anda sedia untuk deployment.
Langkah 3: Push ke GitHub
Jika Belum Ada Repository:
cd /path/to/your/project
git init
git add .
git commit -m "Initial commit"
Cipta Repository di GitHub:
- Login ke GitHub
- Klik + → New repository
- Masukkan nama repository
- Pilih Private (disyorkan)
- Klik Create repository
Push Kod ke GitHub:
git remote add origin git@github.com:USERNAME/REPO.git
git branch -M main
git push -u origin main
BAHAGIAN C Deploy Aplikasi Static/React
Langkah 1: Cipta Website di Hostiqo (TANPA SSL Dahulu)
- Login ke panel Hostiqo
- Klik Websites → PHP Projects → Add PHP Website
Konfigurasi Website:
| Field | Value |
|---|---|
| Name | nama-aplikasi-anda |
| Domain | app.yourdomain.com |
| Root Path | /var/www/nama_aplikasi |
| Working Directory | /dist |
| PHP Version | 8.3 (sebarang versi) |
| Enable SSL | ❌ No (akan diaktifkan kemudian) |
3. Klik Save
/dist kerana React/Vite menghasilkan fail build di dalam folder tersebut.
Langkah 2: Cipta Webhook untuk Auto-Deploy
1. Klik Webhooks → Create Webhook
Basic Information:
| Field | Value |
|---|---|
| Name | Deploy [Nama App] |
| Domain | (pilih website yang dicipta) |
| Status | Active |
Repository Configuration:
| Field | Value |
|---|---|
| Git Provider | GitHub |
| Repository URL | git@github.com:USERNAME/REPO.git |
| Branch | main |
| Local Path | /var/www/nama_aplikasi |
| Deploy User | www-data |
SSH Key:
- ✅ Tandakan Auto-generate SSH Key Pair
2. Klik Save
Langkah 3: Konfigurasi Post-Deploy Script
- Buka semula webhook yang dicipta
- Klik Edit
- Scroll ke bahagian Post-Deploy Script
- Masukkan script berikut:
#!/bin/bash
# Install dependencies
npm install
# Build aplikasi untuk production
npm run build
5. Klik Save
Langkah 4: Setup GitHub Deploy Key
- Di Hostiqo, buka webhook tadi
- Salin SSH Public Key
- Di GitHub repository → Settings → Deploy keys → Add deploy key
| Field | Value |
|---|---|
| Title | Hostiqo Deploy Key |
| Key | (paste SSH key yang disalin) |
| Allow write access | ❌ No |
4. Klik Add key
Langkah 5: Setup GitHub Webhook
1. Di GitHub repository → Settings → Webhooks → Add webhook
| Field | Value |
|---|---|
| Payload URL | (salin dari Hostiqo) |
| Content type | application/json |
| Secret | (salin dari Hostiqo) |
| Events | Just the push event |
| Active | ✅ Yes |
2. Klik Add webhook
Langkah 6: Lakukan Deployment Pertama
Pilihan 1 - Manual Deploy:
Di panel Hostiqo, klik butang Deploy Now
Pilihan 2 - Auto Deploy:
Push sebarang perubahan ke GitHub:
git add .
git commit -m "Update aplikasi"
git push
Proses yang Berlaku:
- GitHub menerima push → trigger webhook
- Hostiqo menerima signal → queue deployment
- Server clone/pull kod terkini
- Jalankan
npm install→ install dependencies - Jalankan
npm run build→ generate folder/dist - Nginx serve fail static dari
/dist
Langkah 7: Aktifkan SSL Certificate
- Di panel Hostiqo, pergi ke Websites
- Klik pada website yang telah di-deploy
- Klik Edit atau ikon settings
- Enable Let's Encrypt SSL
- Klik Save
- Tunggu sehingga SSL status bertukar kepada Active
Langkah 8: Semak Status Deployment
- Di panel Hostiqo, klik Deployments
- Lihat status deployment:
- Success ✅ - Deployment berjaya
- Failed ❌ - Ada masalah (klik untuk lihat log)
- Pending 🟡 - Sedang dalam proses
- Layari domain anda untuk melihat aplikasi:
https://app.yourdomain.com
BAHAGIAN D Penyelesaian Masalah (Troubleshooting)
Masalah 1: Installer Tersekat pada "Updating system packages..."
Punca: Terdapat prompt tersembunyi yang menunggu input pengguna.
Penyelesaian:
- Rebuild/reset server
- Jalankan pre-update secara manual SEBELUM installer:
apt-get update -y && apt-get upgrade -y
- Jawab semua prompt yang muncul
- Kemudian jalankan installer Hostiqo
Masalah 2: Nginx Failed - SSL Directive Duplicate
Error:
"ssl_session_timeout" directive is duplicate in /etc/letsencrypt/options-ssl-nginx.conf
Punca: Conflict antara SSL config Hostiqo dan Let's Encrypt.
Penyelesaian:
# Comment semua ssl directives dalam fail Let's Encrypt
sed -i 's/^ssl_/#ssl_/' /etc/letsencrypt/options-ssl-nginx.conf
# Test konfigurasi Nginx
nginx -t
# Jika OK, reload Nginx
systemctl reload nginx
Kemudian klik Redeploy di panel Hostiqo.
Masalah 3: SSH Fingerprint Error
Error:
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Punca: Server telah di-rebuild dan fingerprint berubah.
Penyelesaian (jalankan di terminal lokal):
ssh-keygen -R [IP_SERVER_ANDA]
Kemudian SSH semula ke server.
Masalah 4: apt-get Lock Error
Error:
E: Could not get lock /var/lib/dpkg/lock-frontend
Punca: Proses apt lain sedang berjalan.
Penyelesaian: Tunggu 2-3 minit, kemudian cuba semula. Atau semak proses yang sedang berjalan:
ps aux | grep apt
Masalah 5: Deployment Tersekat pada Status "Pending"
Penyelesaian:
# Semak status queue worker
sudo supervisorctl status
# Restart queue worker
sudo supervisorctl restart hostiqo-queue:*
# Semak log untuk error
tail -f /var/www/hostiqo/storage/logs/laravel.log
Masalah 6: Permission Denied Semasa Deployment
Penyelesaian:
sudo chown -R www-data:www-data /var/www/nama_aplikasi
sudo chmod -R 755 /var/www/nama_aplikasi
Masalah 7: 502 Bad Gateway
Penyelesaian:
# Semak status PHP-FPM
sudo systemctl status php8.3-fpm
# Restart PHP-FPM
sudo systemctl restart php8.3-fpm
# Semak log
tail -f /var/log/php8.3-fpm.log
Masalah 8: React App Paparan Blank/Kosong
Punca Biasa:
- Aplikasi belum di-build
- Working directory tidak betul
- Kod tidak production-ready
Penyelesaian:
- Pastikan post-deploy script mempunyai:
npm install npm run build - Pastikan Working Directory di website settings adalah
/dist - Semak sama ada folder
/distwujud di server:ls -la /var/www/nama_aplikasi/dist/ - Jika folder kosong atau tiada, build mungkin gagal. Semak log deployment untuk error.
- Pastikan kod dari AI Studio adalah production-ready (rujuk Bahagian B, Langkah 1)
Masalah 9: SSL Certificate Failed
Punca Biasa:
- Cuba enable SSL sebelum deployment pertama
- Folder website belum wujud
- DNS belum point ke server
Penyelesaian:
- Pastikan deployment pertama sudah berjaya SEBELUM enable SSL:
- Cipta website TANPA SSL
- Cipta webhook dan deploy
- Pastikan folder
/var/www/nama_aplikasi/distwujud - Kemudian baru enable SSL
- Semak DNS sudah point ke server:
dig +short yourdomain.com - Request SSL secara manual (jika perlu):
sudo certbot --nginx -d yourdomain.com - Semak konfigurasi Nginx:
nginx -t
Masalah 10: npm run build Gagal
Punca Biasa: Kod dari AI Studio tidak lengkap atau ada error.
Penyelesaian:
- Test build di lokal terlebih dahulu:
npm install npm run build - Jika ada error, minta AI Studio generate semula dengan prompt yang lebih spesifik (rujuk Bahagian B, Langkah 1)
- Pastikan
vite.config.jswujud dan betul
BAHAGIAN E Rujukan Pantas
Arahan Server
# Nginx
sudo nginx -t # Test konfigurasi
sudo systemctl reload nginx # Reload
sudo systemctl restart nginx # Restart
# PHP-FPM
sudo systemctl restart php8.3-fpm
# MySQL
sudo systemctl restart mysql
# Redis
sudo systemctl restart redis-server
# Supervisor (queue workers)
sudo supervisorctl status
sudo supervisorctl restart all
Lokasi Fail Log
# Log Hostiqo
tail -f /var/www/hostiqo/storage/logs/laravel.log
# Log Nginx
tail -f /var/log/nginx/error.log
tail -f /var/log/nginx/access.log
# Log aplikasi anda
tail -f /var/www/nama_aplikasi/storage/logs/laravel.log
Lokasi Fail Penting
| Path | Keterangan |
|---|---|
| /var/www/hostiqo | Pemasangan Hostiqo |
| /var/www/ | Root folder untuk websites |
| /etc/nginx/sites-available/ | Konfigurasi Nginx |
| /root/.mysql_root_password | Password root MySQL |
Update Hostiqo
cd /var/www/hostiqo
sudo php artisan hostiqo:update --sudoers
✅ Senarai Semak Deployment
Penyediaan Server
- Server cloud telah dicipta
- DNS telah dikonfigurasi
- SSH berfungsi
- Pre-update telah dilakukan
- Hostiqo telah dipasang
- Panel boleh diakses
Deploy Aplikasi
- Kod production-ready (boleh build tanpa error)
- Repository GitHub telah dicipta
- Website dicipta di Hostiqo (TANPA SSL dahulu)
- Webhook dicipta
- Deploy key ditambah ke GitHub
- GitHub webhook dikonfigurasi
- Post-deploy script ditetapkan
- Deployment pertama berjaya
- SSL diaktifkan (SELEPAS deployment pertama)
- SSL status Active
- Website boleh diakses via HTTPS
💡 Tips Penting
- Sentiasa pre-update sistem sebelum memasang Hostiqo
- Jangan taip 'y' untuk installation path - tekan Enter sahaja!
- Gunakan PHP Website untuk aplikasi React/static, bukan Node.js Website
- Working Directory
/distuntuk aplikasi React/Vite - Test build di lokal sebelum push ke server
- Gunakan prompt yang betul di AI Studio untuk kod production-ready
- Semak log apabila berlaku error
- Enable SSL SELEPAS deployment pertama - jangan enable semasa create website!