Hosting Permanen dengan STB /Raspberry Pi/Linux

Panduan Hosting di STB / Raspberry Pi / Linux

Instalasi LNMP, Akses Jarak Jauh, dan Otomatisasi Server Mini

1. Perangkat & Persiapan

  • 🧰 STB atau Raspberry Pi yang sudah di-root / unlock
  • 📦 Kartu microSD + card reader
  • 💻 Software: PuTTY, Balena Etcher, Rufus
  • 📡 Koneksi internet dan akses SSH

2. Instalasi OS & Akses STB

Gunakan Balena Etcher atau Rufus untuk flashing sistem operasi (Armbian, Ubuntu Server, dll) ke kartu SD.

# Contoh via Etcher
1. Pilih file .img
2. Pilih device SD Card
3. Klik Flash

Masukkan SD ke STB lalu hubungkan via SSH menggunakan IP yang terdeteksi:

ssh root@192.168.1.x

3. Instalasi NGINX + PHP + MySQL

sudo apt update && sudo apt upgrade
sudo apt install nginx php php-fpm php-mysql
sudo apt install mariadb-server

Pastikan service aktif:

sudo systemctl enable nginx
sudo systemctl enable php7.x-fpm
sudo systemctl enable mariadb

4. Konfigurasi NGINX & Web Directory

sudo mkdir -p /var/www/html
sudo nano /etc/nginx/sites-available/default

Edit block server agar sesuai direktori dan PHP:

root /var/www/html;
index index.php index.html;

location ~ \.php$ {
  include snippets/fastcgi-php.conf;
  fastcgi_pass unix:/run/php/php7.x-fpm.sock;
}

5. Tambahkan Project Web

Buat file uji coba:

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Akses melalui browser: http://IP-STB/info.php

6. Remote Akses via Cloudflare Tunnel

Instal cloudflared:

sudo apt install cloudflared
cloudflared tunnel login

Setelah login, buat tunnel:

cloudflared tunnel create mytunnel

Edit konfigurasi:

sudo nano /etc/cloudflared/config.yml
tunnel: <tunnel-id>
credentials-file: /home/user/.cloudflared/<tunnel-id>.json

ingress:
  - hostname: yourdomain.com
    service: http://localhost:80
  - service: http_status:404

✅ Tips Akhir

  • Gunakan sistem backup otomatis
  • Monitor resource STB/Raspi dengan htop atau glances
  • Amankan akses SSH (ganti port, aktifkan key auth)
  • Uji dari jaringan luar dengan data seluler