Windows service builds a web site, using cpolar intranet penetration to achieve public network access

overview

In this tutorial, we will build a web site on Windows, and through cpolar intranet penetration, release the site online for free, so that public network users can normally access the local web site.

cpolar is a very powerful intranet penetration tool, an essential tool for development and debugging.

It can map the HTTP, HTTPS, and TCP protocol ports of the local intranet server to the public network address port, so that public network users can easily access your intranet server without deploying to the public network server. It supports permanent free use, no need for public network IP, and no need to set up routers.

1. Build a static website

Click to download the TODO LIST test demo site↓

After a successful download, unzip the file

20221117173901

unzipped file

20221117173908

Double-click the program to run the demo site

20221117173915

20221117173920

2. Local browsing test site is normal

Access http://localhost:8080 on the browser , you can see that the page is displayed normally, and the local browsing of the demo site is normal.

20221117173929

At present, the site can only be accessed in your own browser, and other public network users cannot access it. Next, we use cpolar intranet penetration to publish the site to the public network, so that public network users can also access it normally.

3. The local site publishes public network access

3.1 Install cpolar intranet penetration

cpolar official website: https://www.cpolar.com/

Visit the cpolar official website, click the free registration in the upper right corner, register a cpolar account with your email, and log in to the cpolar background.

20221117173841

After logging in successfully, download cpolar to the local, and double-click the installation package to install (the default installation is all the way)

After cpolar is successfully installed, two sample tunnels will be installed by default (you can modify or delete them yourself):

  • remoteDesktop: point to local port 3389, tcp protocol
  • website: Point to local port 8080, http protocol

cpolar official website: https://www.cpolar.com/

3.2 Create a tunnel to map the public network address

After cpolar is successfully installed, visit 127.0.0.1:9200 on the browser , and use the registered cpolar account password to log in to the cpolar web UI management interface. (The default is local port 9200)

20221117173937

Since our demo site port is under port 8080, we can use the website tunnel directly.

After logging in to the cpolar web ui interface, we click on the dashboard on the left to find the website tunnel, and you can see that the display status is normal 隧道管理online status, and you can directly click on the status on the left - online tunnel list to view the generated public tunnel Internet address, just copy the public address and access it on the browser.隧道列表active

20221117173943

Alternatively, we can also re-create a new tunnel: click on the left dashboard 创建隧道:

  • Tunnel name: customizable, be careful not to repeat
  • Protocol: select http
  • Local address: fill in port 8080
  • Domain name type: choose 随机域名(can be used for free)
  • Region: You can choose according to the actual applicable region, support CN, HK, US, TW, EUR

After filling in the tunnel information, click 创建to

20221117173950

3.3 Get the public URL address

状态Click —— on the dashboard on the left 在线隧道列表to see the public network address generated by the online tunnel. You can see that there are two public network addresses in the website tunnel, one is the http protocol and the other is the https protocol. Copy the public network address.

20221117173957

4. Remotely access the intranet website from the public network

Access the public network address generated by cpolar on the browser, in this example https://1ae6da64.r2.vip.cpolar.cn .

Successfully published the intranet web site to the public network for access.

20221117174003

Through cpolar intranet penetration, we have successfully published the local web site under port 8080 to the public network for access, realizing public network access to the intranet. However, since the cpolar used this time is a free package, the generated public network address is a random temporary address that changes every 24 hours.

If you need to use it for a long time, you can configure the site as a second-level subdomain name, or customize a domain name (use your own domain name) for long-term use.

5. Configure a fixed second-level subdomain name

Log in to the background of the cpolar official website , click on the dashboard on the left 套餐to upgrade the cpolar package 基础套餐.

20221117174119

5.1 Reserved second-level subdomains

After the package upgrade is successful, we go back to the background of the cpolar official website , click on the dashboard on the left 预留, and let’s reserve a second-level subdomain for the web site.

  • Region: Select China VIP
  • Name: Fill in the second-level subdomain name you want to keep
  • Description: Remarks, which can be customized

20221117174126

This example reserves a ToDoListsecond-level subdomain named . After the subdomain name is successfully reserved, we copy the subdomain name, and then we need to configure it in the tunnel.

20221117174134

5.2 Configure the second-level subdomain name

Access 127.0.0.1:9200 on the browser and log in to the cpolar web ui management interface. 隧道管理Click —— on the left dashboard 隧道列表, find the tunnel that needs to be configured with a second-level subdomain name (the website tunnel in this example), and click on the right编辑

20221117174141

Modify the tunnel information and configure the second-level subdomain name into the tunnel:

  • Domain Type: Select instead二级子域名
  • Sub Domain: Fill in the second-level subdomain name we just reserved (in this example ToDoList)

After the modification is complete, click更新

20221117174151

状态After the tunnel is successfully updated, click —— on the left dashboard 在线隧道列表, and you can see the public network address of the website tunnel, which has been updated to a second-level subdomain name, and copy the public network address.

20221117174157

6. Test access to the second-level subdomain

Open the browser, let's test access to the successfully configured second-level subdomain.

20221117174205

The test is successful and can be accessed normally. Now, our only private second-level subdomain name in the entire network has been created.

Guess you like

Origin blog.csdn.net/CSDN_anhl/article/details/130251388