background:
In projects, third-party interfaces such as Alipay, WeChat, OSS, etc. are often connected. These services need to call back the application server interface. However, when we were developing locally, the project had not been released yet, and applications running locally could only be accessed from the internal network, but not from the external network. For programmers, this is very troublesome and cannot be debugged immediately. In order to facilitate the development and debugging, we need to map the local computer to the external network to allow third-party services to call back and access. So how to specify the local port mapping to the external network?
Here, I will share with you the most useful tool I have used-ngrok
ngrok official website https://dashboard.ngrok.com
Step 1: Go to the official website to register an account
Step 2: Download the ngrok package https://ngrok.com/download
Step 3: Authentication and authorization https://dashboard.ngrok.com/auth
Step 4: Start ngrok start
Start ngrok start on the command line. By default, no configuration file is specified, and the file will be generated on the computer.
C:\Users\administrator\.ngrok2\ngrok.yml |
Modify the content of ngrok.yml
authtoken: UW9HcuAhNjmhbPznsVk1_34tAWUKuwjN5t83K7J1da
tunnels:
httpbin:
proto: http
addr: 80
demo:
proto: http
addr: 8080
This configuration defines two tunnels with ports 80 and 8080 respectively.
Step 5: Start all tunnels.
At this point, the local port is successfully mapped to the external network.