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

1.1.1-FIX
App Version
PHP-FPM
Runtime
Nginx
Frontend
Riset & Dokumentasi Teknis oleh HARRY DERTIN SUTISNA ALSYUNDAWY IT SOLUTION
0

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.

KomponenVersi / StatusPeran
php-looking-glass1.1.1-FIXAplikasi PHP (index.php) untuk ping, traceroute, host, MTR, uji unduhan, iperf3. Bukan looking glass BGP.
Web serverNginxTLS, HTTP/2, PHP lewat unix socket FPM
PHP8.2–8.5Debian 12: 8.2 · Ubuntu 24.04: 8.3 · Debian 13: 8.4 · Ubuntu 26.04: 8.5 (paket distro)
Tools OSmtr / traceroute / iperf3README resmi: php-cli, php-fpm, php-mbstring, php-xml, ping, traceroute, mtr-tiny, iperf3, dnsutils, whois
FQDNlg.domain.tldRecord A + AAAA ke IP publik
Penting: Aplikasi mengeksekusi utilitas jaringan sebagai user PHP-FPM (www-data). Fungsi exec, shell_exec, dan proc_open harus aktif. Jangan pasang di shared hosting yang menonaktifkan fungsi tersebut.
1

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.

Catatan: Ganti semua lg.domain.tld dengan FQDN produksi. Jangan commit kredensial ke Git publik.
2

Persyaratan Sistem

SpesifikasiMinimalRekomendasi
CPU1 vCPU2 vCPU
RAM1 GB2–4 GB
Storage10 GB20 GB SSD
OSDebian 12 / 13 Ubuntu 24.04 / 26.04 LTS
DNSA dan AAAA untuk lg.domain.tld
Port yang dibuka
PortProtokolFungsi
22TCPSSH
80TCPACME HTTP-01 + redirect HTTPS
443TCPHTTPS publik
5201TCP/UDPiperf3 server (default README: $iperfport = '5201')
3

Persiapan Server

3.1 Update & paket
Bash
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
Paket tools mengikuti README resmi. 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
Bash
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
4

Instalasi Aplikasi

Clone cabang default. File yang dilayani adalah index.php.

Bash
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 {} \;
Update: 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.
5

Konfigurasi index.php

Edit blok konfigurasi di index.php. Nilai berikut diambil dari README resmi.

index.php (cuplikan README)
$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
Bash
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)"
6

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.

Bash
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.

/etc/nginx/sites-available/lg.domain.tld
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;
    }
}
Bash
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).
7

HTTPS Let's Encrypt

Bash
sudo certbot --nginx -d lg.domain.tld --agree-tos -m admin@domain.tld --redirect
sudo systemctl status certbot.timer
8

iperf3 sebagai layanan

UI menampilkan perintah klien ke host/port yang Anda set. Server harus menjalankan daemon di port yang sama.

/etc/systemd/system/iperf3.service
[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
Bash
sudo systemctl daemon-reload
sudo systemctl enable --now iperf3.service
ss -tulnp | grep 5201
Jika distro sudah menyediakan unit iperf3.service, jangan menimpa unit vendor. Cek dulu: systemctl cat iperf3.service.
9

Verifikasi

Bash
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
Browser harus merender UI, bukan mengunduh index.php. Jika terunduh, path fastcgi_pass salah.
10

Troubleshooting

GejalaPenyebabPerbaikan
502 Bad GatewayPHP-FPM mati / socket salahCocokkan /run/php/phpX.Y-fpm.sock
Error fungsi PHP disableddisable_functionsIzinkan exec/shell_exec/proc_open di FPM
Ping gagal / raw socketwww-data tanpa ICMPsysctl ping_group_range atau setcap
MTR kosongmtr-tiny belum terpasangapt install mtr-tiny
iperf timeoutdaemon/firewall 5201Cek unit iperf3 dan UFW IPv4/IPv6
systemctl php*-fpm gagalglob tidak di-expandPakai nama unit persis php8.3-fpm
11

Keamanan & Best Practices

  • Blokir .git (sudah di server block).
  • Looking glass publik bisa disalahgunakan. Pertimbangkan limit_req di Nginx.
  • Backup index.php tersesuaikan sebelum git pull.
  • Jangan buka port manajemen ke internet tanpa restriksi.
Cron backup
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
Dokumentasi berdasarkan alsyundawy/php-looking-glass 1.1.1-FIX (2026-08-07) dan paket Nginx/PHP distro. Ditinjau ulang 16 Agustus 2026.