ngrok คืออะไร - ทำ Localhost เครื่องของผู้พัฒนาอยู่ในเครื่องสามารถ online บน internet ได้

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: ngrok คืออะไร - ทำ Localhost เครื่องของผู้พัฒนาอยู่ในเครื่องสามารถ online บน internet ได้

ngrok คืออะไร - ทำ Localhost เครื่องของผู้พัฒนาอยู่ในเครื่องสามารถ online บน internet ได้

โดย jirawoot » 09/06/2020 11:37 am

screenshot-ngrok.com-2020.06.09-11_08_38 (1).png
screenshot-ngrok.com-2020.06.09-11_08_38 (1).png (35.38 KiB) Viewed 2520 times
ngrok เป็น เครื่องที่ถูกพัฒนาโดย github แบบ open source ซึ่งอำนวยความสะดวกแก่ผู้พัฒนาระบบทำให้ระบบที่พัฒนาอยู่ในเครื่องสามารถ online ได้บน internet สามารถเข้าระบบจากที่ไหนก็ได้ โดยสามารถเข้าใช้งานผ่าน url ของ ngrok ที่จะสุ่มสร้าง url ขึ้นมา ตัวอย่างเช่น xxxxx.ngrok.io ซึ่ง url ที่ได้มานั้น จะเปลี่ยนไปทุกครั้งเมื่อมีการปิด และเปิดใช้งาน โปรแกรมใหม่
ขั้นตอนการใช้งาน
ทำการ login เข้าใช้งาน คลิก
screenshot-dashboard.ngrok.com-2020.06.09-11_11_27.png
screenshot-dashboard.ngrok.com-2020.06.09-11_11_27.png (29.5 KiB) Viewed 2520 times
ให้ทำการ download ตัว ngrok ตาม OS ที่ใช้งานได้เลย
screenshot-dashboard.ngrok.com-2020.06.09-11_14_09 (1).png
screenshot-dashboard.ngrok.com-2020.06.09-11_14_09 (1).png (28.69 KiB) Viewed 2520 times
จากนั้นให้ทำการ unzip แล้วให้ทำการ Connect your account โดย

โค้ด: เลือกทั้งหมด

./ngrok authtoken < token >
screenshot-nimbus-capture-2020.06.09-11_23_07 (1).png
screenshot-nimbus-capture-2020.06.09-11_23_07 (1).png (55.75 KiB) Viewed 2520 times
ทำการรันคำสั่ง

โค้ด: เลือกทั้งหมด

./ngrok http < PORT ที่จะใช้งาน >
screenshot-nimbus-capture-2020.06.09-11_27_03.png
screenshot-nimbus-capture-2020.06.09-11_27_03.png (20.43 KiB) Viewed 2520 times
screenshot-nimbus-capture-2020.06.09-11_28_23.png
screenshot-nimbus-capture-2020.06.09-11_28_23.png (59.46 KiB) Viewed 2520 times
ข้อดีของ ngrok
ใช้สำหรับพัฒนาระบบที่ต้องการ SSL
ใช้สำหรับพัฒนาระบบเพื่อเชื่อมต่อ Web Hook เช่น Facebook API
ใช้สำหรับ Demo งานจากเครื่อง localhost ประหยัดเงินในการเช่า server

อ้างอิง
https://dashboard.ngrok.com/
https://medium.com/@Krucamper/บวกสกิล-developer-ด้วย-ngrok-674ea172ccaa
https://www.hostpacific.com/how-to-install-nrok-on-localhost/

ข้างบน