Ngrok to expose your local web app to the public network

Source: Internet
Author: User

1. Ngrok Introduction

Ngrok is a reverse proxy that establishes a secure channel between the public endpoint and the locally running Web server. The Ngrok captures and analyzes traffic on all channels for later analysis and replay. Simply put, Ngrok can be used to access websites deployed on the local server through an extranet, which also provides a Web Management page to monitor HTTP communication messages, making it easy for programmers to identify problems and develop debugging. In addition, Ngrok supports TCP layer port mapping, not limited to a particular service. Support for Mac OS x,linux,windows platform.

Ngrok Official website: click here

Ngrok Open Source Address: Click here

2. Application Scenario 2.1 Web development

As a web developer, it is sometimes necessary to temporarily deploy a local Web site to an extranet for others to experience evaluation or assist in debugging. The traditional approach is to use dynamic domain names such as peanut shells or set up a VPN to do port mapping, and use Ngrok a few commands to get it done.

2.2 Development

  In the development of the time, you need to use the client to debug the system service function, but in the development phase of the service-side program is generally run on the local server. In this way, there is no way to access the local server resources on the public network. The key to solving local development is the ability to map local service IP to the public network, so Ngrok is useful for local development.

2.3 TCP Port forwarding

TCP port forwarding, which means that you can SSH to the local network, of course, the external network port is randomly assigned.

3. Simple to use

experimental Environment : Windows7, Ngrok 2.1.3

Step1: First go to Ngrok official website to download the latest version of the client. Windows version download after decompression only ngrok.exe a file, temporarily put it in the D packing directory.

STEP2: The first time you use the Ngrok service, you need to first install Authtoken for this machine. Register an account on the Ngrok website and get the official Authtoken under the Auth menu. (This step can be omitted, but unregistered users do not have advanced features such as custom domain names)

Step3: Install Authtoken, press Win+r, and run Cmd.exe. Enter the root directory of the Ngrok.exe and type the following command:

Ngrok Authtoken <YOUR_AUTHTOKEN>

STEP4: With these steps, you can now create a secure tunnel that maps the local service IP to the public network. Execute the command below to assign a random two-level domain name to the native ' localhost:8080 ' address under a Ngrok official website.

8080

Step5: From the Ngrok service opened state can see that ' Http://7a65105c.ngrok.io ' is the generated public domain name. But there is a problem, it is randomly generated, each start Ngrok service will regenerate, in the development of the time is very inconvenient. Ngrok provides a solution that allows the binding of custom level two domain names and top-level domain names (chargeable features) as long as the following commands are executed at the root of the Ngrok.exe:

Ngrok http-subdomain=[two domain name] [port]   // binding Ngrok Level two domain name ngrok http-hostname=[top-level domain] [port]    //  Binding a custom top-level domain

Step6: Open Web interface to check and repeat requests in ' http://localhost:4040 ' to monitor HTTP communication messages.

About Ngrok on this, I am also the first use, many advanced features are not covered. If you crossing need to visit the official documents.

4. Domestic Ngrok Service

Ngrok is a very good tool, but its servers abroad, there are poor access stability, slow and so on. This has brought a lot of inconvenience to the domestic programmer. Fortunately Ngrok is an open source project, some predecessors or companies in the Ngrok project based on the improvement, providing a similar function of domestic Ngrok services.

    • Related recommendations
    1. Sunny-ngrok Intranet Forwarding
    2. Ngrok Domestic Free Server--candy technology
    3. Natapp based on Ngrok high-speed intranet penetration Service
    4. Pc5s-Reverse proxy for Internet to PC

  Its specific usage rules are simple and have detailed documentation or video descriptions.

5. References and extensions

[1] l631068264,windows configuration Ngrok ngrok Use tutorial

[2] Lin Swimming, some thoughts on Ngrok

[3] plansee, self-built Ngrok service and use method

Ngrok to expose your local web app to the public network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.