Cpolar+Tipas: Build a private Q&A website on Ubuntu to provide you with professional answers to questions

Preface

In our life and work, we often encounter various problems. When we encounter problems, we usually look for answers online. However, the answers found online either do not answer the question or are all advertisements. They are really valuable. There are so few answers, which is a headache. It is this pain point that gave rise to question and answer platforms such as "Xuhu", which allow us to find the answers we want easily and quickly. Today, the author will introduce to you how to use Cpolar+Tipask to build a private Q&A website on the ubuntu system

2.Tipask website construction

Tipask is an open source question and answer system developed based on PHP. It supports a variety of databases and can be integrated with Alipay, WeChat, Jixian Verification, Alibaba Cloud Video, DingTalk, etc., which greatly expands the scope of Tipask's application scenarios. The most important thing is that the deployment of Tipask is very simple, and novices like me can easily complete the setup and installation.

2.1 Tipask website download and installation

Like other software, Tipask also has its own official website (www.tipask.com/). We can see various information about Tipask here. If we encounter any problems during installation and use, we can also get the answers here. Or post a question.

img

On the official website of tipask, we can see that tipask is a PHP question and answer system that can support a variety of databases, which means that we need to install Apache, MySQL, and PHP (the so-called LAMP) on the Pagoda panel first. If installed under Linux Nginx, MySQL, and PHP are called LNMP). Usually when you log in to the Pagoda Panel for the first time, as long as Apache, MySQL, and PHP are not installed on the local hardware device, the Pagoda Panel will automatically pop up asking you to choose which web page running programs to install.

img

We can also find the "Software Store" button on the left side of the Pagoda Panel's 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.

img

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.

img

Then, we can proceed to the next step of website deployment. Usually the step of website deployment is to place the downloaded website source code in the wwwroot folder of the Pagoda Panel. Fortunately, tipask provides a "one-click deployment" mode in the Pagoda Panel, which saves the author a lot of trouble.

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 "tipask" entry, and click the "One-click deployment" button on the right side of the entry.

img

Next, the website basic settings window will pop up, where we can specify the basic information of the website, which includes:

Domain name (output port) - In the "Domain name" field, set it in the form of "Domain name to be set: Port to be used"; here I set the output port of tipask to eh 81 (127.0.0.1:81)

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 changes it to tipask.

Database – just fill in the database information you plan to set up here;

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). To ensure stability, the author chooses php7.2 version

After completing these settings, you can click the "Submit" button at the bottom of the window to create the tipask website.

img

After the website is created (a matter of seconds), the Pagoda panel will pop up the address of the created website and important website information (maybe database information, or website background login information).

img

Next, open the Pagoda panel of Ubuntu, click the "Website" button on the left side of the main interface of the software, enter the website list page, and you will see the tipask website that was just installed and online. The biggest advantage of using the Pagoda Panel to deploy the Tipask website with one click is that the Pagoda Panel will automatically enable the PHP extensions required by Tipask and the functions that need to be disabled, saving us the trouble of setting them up ourselves.

img

At this time, we enter the set tipask website address in the Ubuntu browser address bar to enter the tipask website setting page. We continue to carry out specific website settings according to the prompts on the website display page.

img

Before starting the installation, tipask will perform a self-check on the website operating environment. Since we are using the one-click installation mode, the Pagoda panel will automatically set up the required PHP extensions and disabled function items.

img

The next step is to fill in the database information. We only need to fill in the database information set when creating the tipask website.

img

Finally, after we set up the tipask administrator account, we can complete the installation process of the tipask website. For the convenience of demonstration, the author sets the administrator account to admin.

img

img

2.2 Tipask web page test

After completing the installation of the tipask website locally, we can enter the set tipask website address in the Ubuntu browser (127.0.0.1:81 in this example) to access the tipask main page.

img

2.3 Installation and registration of 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 the curl tool first).

Cpolar one-click installation script:

“curl -L

https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash”

img

After the Cpolar installation is completed, you can enter the command "systemctl start cpolar" to start cpolar.

img

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.

img

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.

img

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. As long as you enter the command "sudo systemctl status cpolar" in the Ubuntu command line interface, you can add cpolar to the self-starting list.

img

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.

img

img

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).

img

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".

img

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 directly log in to the cpolar client on the local device (enter localhost:9200 in the browser address bar), and click the "Create Tunnel" button under the "Tunnel Management" item on the cpolar client main interface to enter Create tunnel settings page.

img

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 tipask website is a web program, so choose the http protocol;

Local address – The local address is the output port number of the local tipask 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. 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 of use;

img

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, where we can see all cpolar's local data tunnels (whether 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.

img

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.

img

Paste the public Internet address shown here into the browser address bar to access the local web page.

img

It should be noted that 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.

img

After Cpolar is upgraded to the paid version, you can log in to the cpolar official website (as long as you are a registered cpolar user, you can log in to the cpolar official website regardless of whether you are a paid user, but here we need to log in to the cpolar official website as a paid user to reserve the data tunnel operate).

img

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 (or entrance to the data tunnel) here. At this time, this address is not connected to the local software output port, so it can be regarded as a blank data tunnel.

img

On the reservation page, we can reserve data tunnels using multiple protocols. Here we select the "Reserve second-level subdomain name" field.

img

In the "Reserved second-level subdomain name" field, you need to make several simple settings of information, namely "region" (the area where the server is located, just select the nearest one), "second-level domain name" (which will eventually appear in the generated public Internet address , as one of the identifiers of the network address) and "description" (which 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.

img

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.

img

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 directly). 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.

img

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 connect the public Internet address reserved by cpolar cloud to the tipask data tunnel created by local cpolar. stand up.

We have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, so we changed it to "Second-level subdomain name" (if you reserved a custom domain name, check the custom domain name), and in the next line "Sub Domain" Fill in the reserved second-level subdomain name in the column. Here we fill in "tipaskweb".

img

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 on the cpolar cloud with the local tipask website, thus generating an intranet penetration data tunnel that can exist stably for a long time.

4. Public network access test

Finally, we enter the "Online Tunnel List" page again, and then we will find that tipask's public Internet address has changed. We paste the updated tipask website public Internet address into the browser, and we can access it using the new address. Go to the tipask website on your local ubuntu system.

img

img

5 Conclusion

Basically, the Tipask website is very similar to the forum website, so it is not too difficult to install and deploy. Such low-difficulty website deployment is very friendly to every user. We can use the idle hardware at home to install an ubuntu system that requires less running resources, and use it with the intranet penetration data tunnel created by cpolar to allow idle The hardware becomes our private dedicated server to deploy various websites we need.

Reprinted from cpolar pole cloud article: Cpolar+Tipas: Build a private Q&A website on Ubuntu to provide you with professional answers to questions

Guess you like

Origin blog.csdn.net/weixin_46703995/article/details/132814720