ngrok จะเปิดหลายๆ Port ต้องทำยังไงนะ?

Ans (คำตอบ)
Nov 8 · 1 min read

จากบทความก่อนหน้านี้เราคงได้ลองเล่น ngrok กับ Angular ไปบ้างแล้ว แน่นอนว่า ngrok ไม่ได้มีประโยชน์แค่กับ Angular นะ มันสามารถทำประโยชน์ได้เยอะแยะเลย เพราะมันสามารถ Mapping port localhost ให้สามารถเข้าถึงจากภายนอกได้ ทีนี้เราก็สงสัยสิครับว่ามันเปิดหลายๆ Port ได้มั๊ยนะ เช่น ผมอยาก Run service ไปด้วย และหน้าเว็บไปด้วย หรือรวมไปจนถึงรัน Line Chatbot ไปพร้อมๆกัน เดี๋ยวในบทความนี้เรามาลองทำให้ ngrok สามารถเปิดได้หลายๆ port ลองดูครับ

  1. ให้เข้าไปที่ Path ดังด้านล่าง
C:\Users\XXXX\.ngrok2

2. แก้ไขไฟล์ ngrok.yml

authtoken: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
tunnels:
test1:
addr: 4200
proto: http
test2:
addr: 3000
proto: http

3. ลองรัน ngrok ด้วยคำสั่งข้างล่าง

ngrok start --all

สังเกตุดูว่าจะมีการ Mapping port ทั้งสอง port เลยครับ ก็ลองเอาลิงค์ไปเปิดใช้งานกันได้ครับ ขอบคุณครับบบบ

Ans (คำตอบ)

Written by

| Web Dev| IoT | Data Sci | Business, Trading @ itreeman.github.io

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade