How to configure and save the tunnel parameters established by cpolar?

Article directory

You can use cpolar to create a webpage that can be published to the public Internet. This is based on the fact that we directly set up cpolar immediately and obtain a second-level subdomain that can access local data on the public Internet. But if the computer is turned off and restarted, how to make the computer automatically start cpolar, and remember the set domain name parameter file, so that our webpage can exist stably. Today, we will introduce to you how to save the tunnel parameters established by cpolar .

From a technical point of view, the tunnel parameters of cpolar will be placed in the .yml file, we cannot directly edit this file, otherwise cpolar may not work properly due to grammatical errors, so we need to use a professional text editor: Visual studio Code, edit the .yml of cpolar.

Here you need to download a Visual studio Code software. The official website of this software is in English, and the link to the software is https://code.visualstudio.com/ (as long as you know Download For windows).

However, when the software is installed and used for the first time, it will automatically recognize the language environment of the computer and prompt whether to use other languages ​​for display (the software will automatically download Chinese plug-ins to adapt to Chinese users). After the software is downloaded and installed, we can edit and save the tunnel parameters of cpolar, so that the tunnel parameters we configured will be applied when cpolar starts automatically, avoiding the trouble of manually configuring tunnel parameters repeatedly.

First open Visual studio Code, click "File" on the top of the software interface, and select "Open File..." in the drop-down menu. At this time, the software will jump out of the file selection interface. We need to click to guide the configuration data folder of the specified user in the cpolar software, Visual studio Code will automatically display which file can be edited, assuming our cpolar configuration file is placed in "C:\User (user name folder).cpolar\cpolar.yml", then we only need to click C on the file selection interface Disk - user folder - user name folder to configure data - .cpolar directory - cpolar.yml file, click the "Open" button.

img

Then, we can edit the cpolar.yml file.

img

Seeing this interface, I believe that everyone can already understand the feelings of programmers, but don’t be intimidated by this series of words and symbols. In fact, these words and symbols have their own meanings. After they are combined into commands, they can Tell the computer what to do in this step and what to do in the next step. The meanings of the words and characters shown in the picture are:

authtoken: xxxxxxxxxxxx       #认证token(cpolar仪表盘里那一串看似无意义的字母数字组合)

tunnels:
remoteDesktop:         #隧道名称,表示远程桌面,名称可以自定义
addr: 3398             #端口号为3389
proto: tcp             #协议tcp
region: cn_vip         #地区,cn_vip,可选:us,hk,cn,cn_vip
website:               #隧道名称,用户可以自定义,但多隧道时,每个隧道名称不能重复
addr: 8080             #本地Web站点端口
proto: http            #协议http
region: cn_vip         #地区,cn_vip,可选:us,hk,cn,cn_vip

And we only need to modify two places here, namely:

  • "Modify the default port 8080 of the website tunnel to port 80"
  • "Below the website tunnel parameters, add a line of subdomain: "your second-level subdomain name""

Please refer to the figure below for specific modifications:

img

After modifying the corresponding file, just click the "Save" button on the left to complete the configuration of the cpolar.yml file

img

It should be noted that Visual studio Code will display different colors for edits that may be formatted incorrectly, so it must be noted that if the color of the edited file is different from that of other projects, it is likely that the grammar is wrong. Pay attention to check the indentation and Font (generally requires the English half-width input that comes with the computer).

In order to make sure that we have configured the cpolar.yml file correctly, we can open cpolar for a small test.

Just open cpolar, enter "cpolar start-all" (meaning to start all the tunnels saved in the configuration file), if you can see " http://dev9" in cpolar (here is the name given to the tunnel by the user himself) . http://vip.cpolar.cn -> http://localhost:80" and " https://dev9 (also the name given to the tunnel by the user himself). http://vip.cpolar.cn -> http://localhost:80", it means that cpolar has successfully started the tunnel according to the information stored in the configuration file, and it also means that we have successfully edited the cpolar.yml file.

/localhost:80", it means that cpolar has successfully started the tunnel according to the information stored in the configuration file, and it also means that we have successfully edited the cpolar.yml file.

After this step is completed, we only need to make the necessary settings for the cpolar self-starting service, and then we can change cpolar to automatically start when the computer is turned on, without having to manually set the tunnel information after each cpolar startup, which also ensures long-term stable access to our web pages lay the foundation. In order to ensure that the webpage can be opened quickly by visitors, we suggest that the cpolar package can be upgraded to accommodate more visitors to visit the webpage at the same time. If you have any questions about the use of cpolar , welcome to communicate with us, and we will provide you with the best possible help.

Reprinted from cpolar pole cloud article: How to configure and save the tunnel parameters established by cpolar?

Guess you like

Origin blog.csdn.net/syf666250/article/details/131958092