ALSYUNDAWY PHP Looking Glass
Instalasi terbaru di Debian 12/13 & Ubuntu 24.04/26.04 dengan Nginx + PHP-FPM
Subdomain lg.domain.tld · Dual Stack · HTTPS · iperf3
Ringkasan Status Komponen & Arsitektur
Sumber resmi: github.com/alsyundawy/php-looking-glass. Konstanta di cabang default per 7 Agustus 2026: APP_VERSION = 1.1.1-FIX, APP_UPDATED = 2026-08-07.
| Komponen | Versi / Status | Peran |
|---|---|---|
| php-looking-glass | 1.1.1-FIX | Aplikasi PHP (index.php) untuk ping, traceroute, host, MTR, uji unduhan, iperf3. Bukan looking glass BGP. |
| Web server | Nginx | TLS, HTTP/2, PHP lewat unix socket FPM |
| PHP | 8.2–8.5 | Debian 12: 8.2 · Ubuntu 24.04: 8.3 · Debian 13: 8.4 · Ubuntu 26.04: 8.5 (paket distro) |
| Tools OS | mtr / traceroute / iperf3 | README resmi: php-cli, php-fpm, php-mbstring, php-xml, ping, traceroute, mtr-tiny, iperf3, dnsutils, whois |
| FQDN | lg.domain.tld | Record A + AAAA ke IP publik |
www-data). Fungsi exec, shell_exec, dan proc_open harus aktif. Jangan pasang di shared hosting yang menonaktifkan fungsi tersebut.Pendahuluan
Tutorial ini memasang ALSYUNDAWY PHP Looking Glass dari repositori resmi di Debian 12/13 atau Ubuntu 24.04/26.04 LTS. Frontend Nginx, backend PHP-FPM, publik di https://lg.domain.tld.
Ini aplikasi PHP mandiri. Fitur: deteksi IP klien IPv4/IPv6, ping, traceroute, host/DNS, MTR, tes unduhan, dan perintah klien iperf3. Bukan pengganti hyperglass (BGP) atau phpIPAM.
lg.domain.tld dengan FQDN produksi. Jangan commit kredensial ke Git publik.Persyaratan Sistem
| Spesifikasi | Minimal | Rekomendasi |
|---|---|---|
| CPU | 1 vCPU | 2 vCPU |
| RAM | 1 GB | 2–4 GB |
| Storage | 10 GB | 20 GB SSD |
| OS | Debian 12 / 13 Ubuntu 24.04 / 26.04 LTS | |
| DNS | A dan AAAA untuk lg.domain.tld | |
Port yang dibuka
| Port | Protokol | Fungsi |
|---|---|---|
22 | TCP | SSH |
80 | TCP | ACME HTTP-01 + redirect HTTPS |
443 | TCP | HTTPS publik |
5201 | TCP/UDP | iperf3 server (default README: $iperfport = '5201') |
Persiapan Server
3.1 Update & paket
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git ca-certificates gnupg lsb-release \
ufw nginx certbot python3-certbot-nginx \
php-cli php-fpm php-mbstring php-xml \
iputils-ping traceroute mtr-tiny iperf3 dnsutils whois
php -v
command -v ping traceroute mtr iperf3
iputils-ping menyediakan binary ping di Debian/Ubuntu. php-json sudah built-in di PHP 8 dan tidak wajib diinstal terpisah.3.2 DNS & firewall
dig A lg.domain.tld +short
dig AAAA lg.domain.tld +short
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw allow 5201/tcp
sudo ufw allow 5201/udp
sudo ufw --force enable
sudo ufw status verbose
Instalasi Aplikasi
Clone cabang default. File yang dilayani adalah index.php.
sudo mkdir -p /var/www
sudo git clone --depth 1 https://github.com/alsyundawy/php-looking-glass.git /var/www/php-looking-glass
sudo chown -R www-data:www-data /var/www/php-looking-glass
sudo find /var/www/php-looking-glass -type d -exec chmod 755 {} \;
sudo find /var/www/php-looking-glass -type f -exec chmod 644 {} \;
cd /var/www/php-looking-glass && sudo git pull --ff-only lalu cek ulang variabel di index.php jika upstream mengubah blok konfigurasi. Backup file itu dulu.Konfigurasi index.php
Edit blok konfigurasi di index.php. Nilai berikut diambil dari README resmi.
$ipv4 = 'lg.domain.tld';
$ipv6 = 'lg.domain.tld';
$siteName = 'LOOKING GLASS NETWORK TOOLS';
$siteUrl = 'https://lg.domain.tld';
$iperfport = '5201';
Sesuaikan juga lokasi, ASN, dan kontak jika ada di blok yang sama. Setelah simpan, reload PHP-FPM karena aplikasi menonaktifkan revalidasi OPcache di mode produksi.
5.1 Izin ICMP untuk www-data
echo 'net.ipv4.ping_group_range = 0 2147483647' | sudo tee /etc/sysctl.d/99-ping.conf
sudo sysctl --system
# cadangan jika kernel menolak group range:
# sudo setcap cap_net_raw+ep "$(command -v ping)"
Nginx + PHP-FPM
Deteksi versi PHP dan socket, lalu tulis server block. Jangan memakai glob php*-fpm pada systemctl — unit systemd tidak selalu expand glob.
PHP_VER="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
echo "PHP ${PHP_VER}"
ls -l "/run/php/php${PHP_VER}-fpm.sock"
Ganti path socket di server block sesuai keluaran di atas.
server {
listen 80;
listen [::]:80;
server_name lg.domain.tld;
root /var/www/php-looking-glass;
index index.php;
client_max_body_size 16m;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
add_header X-Frame-Options SAMEORIGIN always;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_read_timeout 180s;
fastcgi_param HTTP_PROXY "";
}
location ~ /\.(git|github|ht) {
deny all;
}
}
PHP_VER="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
sudo ln -sfn /etc/nginx/sites-available/lg.domain.tld /etc/nginx/sites-enabled/lg.domain.tld
sudo nginx -t
sudo systemctl enable --now nginx "php${PHP_VER}-fpm"
sudo systemctl reload nginx
disable_functions di /etc/php/${PHP_VER}/fpm/php.ini tidak boleh memblokir exec, shell_exec, proc_open, proc_close. Setelah mengubah php.ini: sudo systemctl reload "php${PHP_VER}-fpm". Tes unduhan butuh fastcgi_read_timeout yang cukup panjang (README menekankan timeout/performa).HTTPS Let's Encrypt
sudo certbot --nginx -d lg.domain.tld --agree-tos -m [email protected] --redirect
sudo systemctl status certbot.timer
iperf3 sebagai layanan
UI menampilkan perintah klien ke host/port yang Anda set. Server harus menjalankan daemon di port yang sama.
[Unit]
Description=iperf3 server for Looking Glass
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/iperf3 -s -p 5201
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now iperf3.service
ss -tulnp | grep 5201
iperf3.service, jangan menimpa unit vendor. Cek dulu: systemctl cat iperf3.service.Verifikasi
curl -4 -I https://lg.domain.tld
curl -6 -I https://lg.domain.tld
sudo -u www-data ping -c 2 1.1.1.1
sudo -u www-data traceroute -n -w 2 -q 1 1.1.1.1
sudo -u www-data mtr -r -c 3 1.1.1.1
iperf3 -c lg.domain.tld -p 5201 -t 5
index.php. Jika terunduh, path fastcgi_pass salah.Troubleshooting
| Gejala | Penyebab | Perbaikan |
|---|---|---|
| 502 Bad Gateway | PHP-FPM mati / socket salah | Cocokkan /run/php/phpX.Y-fpm.sock |
| Error fungsi PHP disabled | disable_functions | Izinkan exec/shell_exec/proc_open di FPM |
| Ping gagal / raw socket | www-data tanpa ICMP | sysctl ping_group_range atau setcap |
| MTR kosong | mtr-tiny belum terpasang | apt install mtr-tiny |
| iperf timeout | daemon/firewall 5201 | Cek unit iperf3 dan UFW IPv4/IPv6 |
| systemctl php*-fpm gagal | glob tidak di-expand | Pakai nama unit persis php8.3-fpm |
Keamanan & Best Practices
- Blokir
.git(sudah di server block). - Looking glass publik bisa disalahgunakan. Pertimbangkan
limit_reqdi Nginx. - Backup
index.phptersesuaikan sebelumgit pull. - Jangan buka port manajemen ke internet tanpa restriksi.
0 3 * * 0 tar -czf /var/backups/php-lg-$(date +\%F).tar.gz \
/var/www/php-looking-glass/index.php \
/etc/nginx/sites-available/lg.domain.tld \
/etc/systemd/system/iperf3.service