Ngrok: Armbian

From AbahDoku Wiki

Instalasi

atau (yang penulis gunakan untuk Linux ARM64)

wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz

tar -xvf ngrok-v3-stable-linux-arm64.tgz

pastikan sudah ada file ngrok dengan perintah

ls

kemudian pindahkan file ngrok ke /usr/bin

mv ngrok /usr/bin

Instalasi lain dapat dilakukan seprti ini :

apt update
apt -y install snapd
snap install ngrok

Pembuatan fail yml

ngrok authtoken "isi_token_disini"

akan muncul hasilnya seperti ini

Authtoken saved to configuration file: /root/.config/ngrok/ngrok.yml

Menambahkan Script (Berikut adalah Contoh)

Script ini sesuai kebutuhan masing-masing, letakkan di bawah baris terakhir pada file yml

tunnels:

 ssh:
   proto: tcp
   addr: localhost:22
   host_header: localhost:22
 web:
   proto: http
   addr: localhost:8080
   host_header: localhost:808

Membuat script autorun

berjalan secara otomatis jika server di restart

[Unit]
Description=ngrok
After=network.target
[Service]
ExecStart=ngrok start --all --config /root/.config/ngrok/ngrok.yml
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
IgnoreSIGPIPE=true
Restart=always
RestartSec=3
Type=simple
[Install]
WantedBy=multi-user.target

Running

systemctl enable ngrok.service

hasilnya :

Created symlink /etc/systemd/system/multi-user.target.wants/ngrok.service -> /lib/systemd/system/ngrok.service.

Untuk start

systemctl start ngrok.service

Untuk Stop

systemctl stop ngrok.service

Running yg lain

Jika di install menggunakan snap

/snap/bin/ngrok authtoken <your_auth_token>
/snap/bin/ngrok help
/snap/bin/ngrok http 80


Contoh2 lain

ngrok http 80                    # secure public URL for port 80 web server
ngrok http -subdomain=baz 8080   # port 8080 available at baz.ngrok.io
ngrok http foo.dev:80            # tunnel to host:port instead of localhost
ngrok http https://localhost     # expose a local https server
ngrok tcp 22                     # tunnel arbitrary TCP traffic to port 22
ngrok tls -hostname=foo.com 443  # TLS traffic for foo.com to port 443
ngrok start foo bar baz          # start tunnels from the configuration file

Referensi


Pranala Menarik