Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Quickly build your own server in one minute

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

When doing mobile applications, the localhost address generated by the local server cannot be opened on the mobile side, so we also need a reverse proxy. Let's talk about how to quickly build a server of our own.

1. Local server

Local servers can be generated in many ways, using automated build tools such as grunt,glup,webpack, and so on. You can also use nodejs. Here's a general way: http-server.

Npm install-g http-server / / Global installation of http-server

one

Http-server / / run http-server

one

An address of localhost will be generated

Enter localhost:8080 in the browser to open the local page.

Of course, linux users can also use the simpler python to build.

two。 Reverse proxy

We do not choose the method of generating the public key as described on the official website. We first select the corresponding version to download to the project, then run ngrok.exe, and enter:

Ngrok http 8080 / / use the port number generated by the corresponding local server

one

A URL is generated as follows:

In this way, we can open the URL to view the page in the browser of any device.

The disadvantage of this approach is that it needs to be regenerated after each disconnect, and the address is not unique, but it is more convenient and quick for you to debug the project.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report