Article directory
- 1 Introduction
- 2. Website construction
-
- 2.1. Web download and installation
- 2.2.Web page testing
- 2.3.cpolar installation and registration
- 3. Local web page publishing
-
- 3.1.Cpolar temporary data tunnel
- 3.2.Cpolar stable tunnel (cloud settings)
- 3.3.Cpolar stable tunnel (local settings)
- 4. Public network access test
- 5 Conclusion
1. Preface
As an important branch of the Linux system, the Ubuntu system not only has the lightweight, high scalability and long-term stable operation of the Linux system, but also has the same friendly graphical interface as Windows, so it can be a good choice for familiar server systems. For the author, the greatest use of the Ubuntu system is that it can rejuvenate the old computers at home, allowing the computers that have been relegated to the second line to be paired with the cpolar intranet penetration software to become a private server, and build various types of computers that you like. website. Today, the author will introduce to you how to use cpolar intranet penetration + Z-blog to build a private blog website.
2. Website construction
Z-blog is a well-known personal blog website. Its small size and large number of extension plug-ins make Z-blog highly playable, and it has become the first choice for many private bloggers to build personal blogs. Of course, the Z-blog website built on a personal computer is difficult to access by public Internet visitors, but through the intranet penetration data tunnel built by cpolar, the personal computer can be transformed into a private server. Your personal blog website can naturally be visited by everyone. Now, let’s get started.
2.1. Web download and installation
Since the operation of Z-blog requires multiple supporting programs, such as Apache or Nginx, PHP, SQL, etc., in order to facilitate the software management of these web pages, the author uses the Pagoda panel to establish the website operating environment, thereby avoiding the need to run the required software on these web pages. The trouble of setting them up separately.
Usually, a formal software will have its own official website. We can find the software’s download, installation instructions and other information on the software’s official website, and Z-blog is no exception. But Pagoda Panel provides one-click deployment and installation methods for many mainstream and commonly used websites, which saves us a lot of trouble. In fact, the one-click deployment function of the Pagoda Panel also follows the normal website deployment steps (download the website source code and install the website itself under the website support program), except that some simple steps are included in the automatic running directory.
After visiting the official website of Z-blog, we can see that Z-blog supports multiple versions of php and also supports multiple database software, which means that we need to install Apache, MySQL, and PHP (the so-called LAMP, if Nginx, MySQL, and PHP are installed under Linux, it is called LNMP).
We can also find the Software Store
button on the left side of the Pagoda Panel homepage (you can enter the local address in the browser: Pagoda Panel output port number) and click to enter the Software Store page. On this page, we can find commonly used website running support programs, including Nginx, Apache, MySQL, PHP, phpMyadmin, Tomcat, Docker manager, Redis, etc. We find the required software and click “Install” on the right side of the software entry to install it on the Ubuntu system.
In order to ensure the compatibility of the Z-blog website, the author chose to install PHP7.2. If some websites specify PHP versions, just choose the corresponding PHP version to install.
After completing the installation of Apache, MySQL, and PHP software, we can click the Installed
button at the top of the software store page to view the installed software. At the same time, you can also switch the version of each software here.
Then, click the Database
button on the left side of the main interface of the Pagoda panel to enter the database settings page. Here we set up a database for Z-blog. The setting content is mainly the database name and password.
After the database setting is completed, we click “Software Store” on the left side of the main interface of the Pagoda panel. After entering the software store, find the One-click deployment
button at the top of the page, enter the website page that can be deployed with one click, select the Z-blog
entry, and click on the right side of the entry One-click deployment
button.
Then enter the website basic settings window, where we can specify the basic information of the website, which includes:
- Output port number – In the “Domain name” field, set it in the form of “Domain name to be set: Port to be used”;
- Root Directory – This field can be changed or not, but the content of this root directory will be linked to the “Domain Name” field. To prevent confusion, the author still changed it to zblog
- Database – just fill in the database information we set up before;
- PHP version – Some websites may require the use of a specific version of PHP, and we can modify it in the PHP version field (provided that the corresponding version of PHP software has been installed)
After completing these settings, you can click the “Submit” button at the bottom of the window to officially create the zblog website.
After the website is created (a matter of seconds), the pagoda panel will pop up the address of the created website, as well as the zblog backend login username and password.
2.2. Web page testing
Finally, we enter localhost:81
(local port 81) in the local browser and try to access the newly created zblog website.
But strangely, the zblog website reported incorrect database information (the database information is stored in the c_option.php file in the zb_users folder), so we followed the website prompts and clicked the “Website” button on the left side of the pagoda panel to open the root directory of zblog. Find the c_option.php file in the zb_users folder in the root directory.
After finding the c_option.php
file, double-click it to open it for editing. In the editing window of the c_option.php file, you can find entries in the format of ZC_MYSQL_XXXXXXX
. Here we can see that ZC_MYSQL_USERNAME
, ZC_MYSQL_PASSWORD
, and ZC_MYSQL_NAME
are incorrect.
Therefore, we replace the existing content with the previously set database name, username and password of the zblog database, and then click the “Save” button in the upper left corner of the editing window to save the modified content in the c_option.php file.
At this time, when we visit the zblog web page again, we can see that the zblog web page can be displayed normally.
Installation and registration of 2.3.cpolar
After completing the deployment of the web page, you can move to the installation of cpolar. If you want to install cpolar on an ubuntu system, you can use the simple one-click installation script to install it. As long as you enter the following command on the command line interface of ubuntu, you can automatically execute the installation program (it should be noted that some ubuntu versions may not have the curl tool installed, so it is best to execute the command sudo aptinstall curl
to install it first) curl tool).
cpolar address: https://www.cpolar.com/
Cpolar one-click installation script:
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
After the Cpolar installation is complete, you can enter the command to start cpolar.
systemctl start cpolar
At this time, the ubuntu system will pop up the authentication box for starting the service. We can enter the password of the ubuntu system.
Of course, we can also enter cpolar version
to query the local cpolar version number instead of using the systemctl level command. As long as the version information can be displayed, the cpolar installation is complete.
In order to ensure that cpolar can run on the Ubuntu system for a long time and ensure the stable existence of the data tunnel, it is best to add cpolar to the Ubuntu boot auto-start list. Just enter the command in the Ubuntu command line interface to add cpolar to the self-starting list.
sudo systemctl status cpolar
In order to ensure the data security of each user and create a separate data tunnel for each customer, cpolar uses user password and token code for user verification, so we need to register the user before using cpolar. The registration process is very simple. Just click “User Registration” in the upper right corner of the cpolar homepage and fill in the necessary information on the registration page to complete the registration.
After completing the cpolar user registration, we can use each user’s unique token code to activate the cpolar client. As long as you log in to the cpolar official website, you can find the user’s unique token code on the Verification
page (or the “Connect your account” window).
Copy and paste this token code into the Ubuntu command line interface, and the cpolar client will write the token code into the local cpolar.yml file (token code activation only needs to be done once) as an identification of the user data tunnel. information. The specific command format is cpolar authtoken user’s unique token code
.
3. Local web page publishing
At this point, we have installed the web page on the local device and also installed the cpolar intranet penetration program. Next, we can use cpolar to create a safe and efficient data tunnel for the local web page, so that our local web page can be accessed on the public Internet. Visited.
3.1.Cpolar temporary data tunnel
In order to meet the temporary testing function of web pages required by some customers, cpolar can create a temporary data tunnel directly on the cpolar client (the public Internet address is reset every 24 hours). To create a temporary data tunnel, we log in to the cpolar client directly on the local device (enter localhost:9200 in the browser address bar), and click Tunnel Management
on the main interface of the cpolar client. >Create Tunnel button to enter the tunnel creation setting page.
On the “Create Tunnel” page, we need to set several information settings, which include:
Tunnel name
– can be regarded as the tunnel information comment of the cpolar client, as long as it is convenient for us to distinguish;Protocol
– The website is a web program, so choose the http protocol;Local address
– The local address is the output port number of the local website. Fill in 81 here according to our settings;Domain name type
– Here we can distinguish whether the data tunnel is for temporary use or long-term existence. Since we are only conducting a temporary test first, we choose “random domain name” (the second-level subdomain name and custom domain name are both long-term stable tunnels and need to reserve a public Internet address in the cpolar cloud).Region
– This is the location of the server. We can fill it in according to the actual location;
After completing these settings, you can click the Create button
at the bottom of the page to establish a temporary data tunnel. After the temporary data tunnel is created, the cpolar client will automatically jump to the Tunnel List
page under the Tunnel Management
item. Here we can see all cpolar local data tunnels. (either temporary or long-term). We can also manage the data tunnel here, including opening, closing or deleting this tunnel. We can also click the “Edit” button to modify the information of this data tunnel.
The temporary public Internet address we created that can connect to the local website can be found in the Online Tunnel List
under the Status
item.
Paste the public Internet address shown here into the browser address bar to access the local web page.
However, the data tunnel at this time is only a temporary data tunnel and will be reset every 24 hours. After the data tunnel is reset, the public Internet address generated by cpolar will change. If you plan to visit this web page again, you need to use the newly generated address.
3.2.Cpolar Stable Tunnel (Cloud Settings)
If we want to set up a long-term stable data tunnel for the local website, we need to upgrade cpolar to the VIP version first.
After Cpolar is upgraded to the paid version, you can log in to cpolar’s official website, find the Reserve
button on the left side of the user’s home page, click to enter cpolar’s data tunnel reservation page, and generate a public Internet address here (Or called the entrance of the data tunnel). At this time, this address is not connected to the local software output port, so it can be regarded as a blank data tunnel.
On the reservation page, we can reserve data tunnels using multiple protocols. Here we select the Reserve second-level subdomain name
field.
In the “Reserved second-level subdomain name” field, you need to make several simple settings:
Region
(the region where the server is located, just select the nearest one)Second-level domain name
(will eventually appear in the generated public Internet address as one of the identifiers of the network address)Description
(can be regarded as a description of this data tunnel, as long as it can be distinguished from other tunnels).
After completing these settings, you can click the Reserve
button on the right to retain this data tunnel.
Of course, if you no longer plan to use this data tunnel, you can click the “x” on the right to easily delete it and save valuable tunnel quota.
3.3.Cpolar Stable Tunnel (local settings)
After completing the settings of the cpolar cloud and retaining the blank data tunnel, we returned to the local cpolar client and connected the blank data tunnel generated by the cloud with the local test page.
Open and log in to the cpolar client on the local device (you can enter localhost:9200 in the browser to access it directly, or you can click the cpolar client shortcut in the start menu).
Click the Tunnel List
button under the Tunnel Management
item on the left side of the client’s main interface to enter the local tunnel page, and then click the Edit
button of the corresponding tunnel. .
On the Edit
page of the local tunnel (the same as the page for creating a local temporary tunnel), we only need to modify the Domain name type
to set the reserved public Internet address on the cpolar cloud , connected to the zblog data tunnel created by local cpolar.
We have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, so we will change the previous random domain name
to secondary subdomain name
(if the reservation is a custom domain name, check the custom domain name), and fill in the reserved second-level subdomain name
in the Sub Domain
column on the next line. Here we fill in “zblogtest”.
After completing the change of “Domain Name Type”, you can click the Update
button at the bottom of the page to connect the blank data tunnel in the cpolar cloud with the local zblog website, thus generating a zblog website address that can exist stably for a long time. .
4. Public network access test
At this time, when we enter the Online Tunnel List
page again, we will find that the public Internet address of the local zblog has changed. We paste the new local zblog website public Internet address into the browser and it can be used Stable data tunnel to access local zblog website.
5. Conclusion
At this point, we have successfully built a private zblog website on the local Ubuntu system, and penetrated the data tunnel through the intranet created by cpolar, so that Internet visitors can easily access our website. Although there were some twists and turns in the process, it was resolved smoothly. Using the same idea, we can also build other types of websites locally, and then publish them to the public Internet through the data tunnel created by cpolar, upgrading our personal computers to private servers, bringing more to our lives and work. convenient.