An overview of the

This tutorial is the fourth in a series of tutorials on how to build Web sites using CPolar under Windows. We have already introduced the installation of CPolar, set up a simple demonstration site, and configured it to start from the boot. If you haven’t seen the previous tutorial, please read Article 1 first.

This article goes on to build a really useful Web site that you can use to write blogs, build your own business sites, trade sites, etc., and publish to the public network.

Lead to

View the component dependency requirements for the current WordPress version

Visit the WordPress website: wordpress.org/download/

At the time this tutorial was published, the current version of WordPress is 5.8.2

As shown in the red box below, it relies on PHP 7.4

Compare the component versions in PHPStudy. PHP 7.4 is not currently installed and will need to be installed later. Everything else is enough.

Next, we need to do the following:

  • Install database management tools
  • Create a database
  • Installing PHP 7.4
  • Create a new site for WordPress
  • Install and configure WordPress

Procedure 1 Install the database management tool

1.1 Installing graphical Figure DATABASE management tool, SQL_Front

In the PHPStudy panel – Software Administration – locate SQL_Front and click the Install button

After installation, click the Administration button to open the database tool

Select the LocalHost local database and click the Open button

If there is an error message, click OK and ignore it.

2 Create a new database

2.1 Creating a Database

Right-click on localHost and select New — database

The database name can be customized as follows:

Database name: wordpress Character set: UTF8MB4 Character set School team: UTF8MB4_unicoDE_CI

After that, click ok.

The database is created successfully.

2.2 Creating a user for the database

For security purposes, we create a separate username and password for our wordpress database to administer, rather than using root.

Right click in the user, pop-up menu, select New – user

In this case, we create a simple user name user1 with the password 12345678

Note: This example is for educational demonstration, simple username and password, you in a production environment, should create more complex username and password.

Select the permission bar, add permissions for users, select database in Grant Permissions, and specify wordpress database, and then select all permissions on the right. This user can only control the wordpress database and cannot read or write to other databases.

Select the configured wordpress permissions and click OK.

After adding, it will look like the picture below:

The installation PHP7.4

From the PHPStudy Administration panel — Software Administration — PHP7.4.3nts, click Install.

Create a new site

4.1 Creating a Site Root Directory

We create a website directory on disk D, and a site1 directory below as the root directory of this wordpress site, as shown in the picture:

4.2 Visit the WordPress official website to download the latest version of the compression package

Download it at wordpress.org/latest.zip

After downloading unzip, copy all file contents

Paste it into site1 directory as shown below:

4.3 Creating a Web Site

In the PHPStudy panel – Site – click the Create Site button

According to the following figure:

We’ve created a new site on the local machine, port 8080. The diagram below:

4.4 Open a browser and test it

http://localhost:8080/, if the following figure is displayed, the new website is successfully created.

5 cpolar configuration

If you have not installed CPolar before, please refer to the first tutorial in this series.

5.1 Reserve a Second-level Subdomain name in the Background

Cpolar background — Reserved — Reserved secondary subdomain name. In this example, secondary subdomain name: dev10 (you can configure different subdomain names) Region: China VIP (CN_VIP) Description: wordpress (optional)

The diagram below:

5.2 Modifying the CPolar Configuration File to add a tunnel pointing to port 8080

Using VS Code, open the CPolar profile

In this case, the path to the configuration file is: C:\Users\ Michael.cpolar \cpolar.yml

Open style:

At the end of the configuration file, we add a new tunnel named wordpress, which points to port 8080, secondary subdomain dev10, and region CN_VIP, as follows:

WordPress: proto: HTTP addr: "8080" subdomain: dev10 # change here to your own region: cn_VIPCopy the code

The modified configuration file is shown as follows:

Note: The ymal format is indent sensitive, notice that the indentation of the wordpress tunnel is the same as the indentation of the demo site website above.

If the indentation is inconsistent, adjust it appropriately.

After modification, save the file.

5.3 Verifying the CPolar Configuration File

Open the CLI as an administrator

Shut down the cPolar service in the background

cpolar service stop
Copy the code

Run cpolar in the foreground with the subcommand start-all, which means start all tunnels of the profile to test if the profile is correct.

cpolar start-all
Copy the code

If the following figure is displayed, the configuration file is correct.

Press CTRL+C to close the foreground Cpolar

Start the background Cpolar service

cpolar service start
Copy the code

Let’s open the browser and test dev10.vip.cpolar. Cn /

If the following figure is displayed, the public domain name is successfully configured.

6 initial configuration of WordPress

6.1 WordPress Initialization Settings

Now start your WordPress initialization setup

Select Simplified Chinese and press continue

Use the database account and password you created earlier

Here you can customize the configuration according to your preference, click Install WordPress

After the installation is successful, go to the background control panel of WordPress

WordPress installation successful!

6.2 Customizing themes for WordPress

WordPress is very customizable. By clicking your site name in the WordPress banner at the top of the page (when you are logged in), you will be taken to the dashboard. From there, you can change themes, add pages and posts, edit menus, add plug-ins, and more. This is just a taster for setting up some interesting things on Raspberry Pi’s Web server.

Now, let’s try a different theme.

WordPress Dashboard –> Appearance –> Theme

Click the Install theme button as shown below:

Click popular, select a theme you like, and click install

After the theme is installed successfully, click the Enable button.

Open a new browser window and open dev10.vip.cpolar. Cn /

Let’s take a look at the effects of the new theme.

A: congratulations! Our new blog site is almost complete!

6.4 Installing the relative URL Plug-in for WordPress (Required)

You must ensure that WordPress is published as a relative URL, or you will get an error when accessing using an HTTPS address.

You can do this by installing one of the following plug-ins

Plug-in:

  • odt-relative-urls
  • relative-url
  • root-relative-urls

In this example, we install the Relative URL plugin:

  • Login WordPressThe dashboard–>The plug-in–>Installing a plug-in

  • Type in the keyword search barRelative URLenter

  • Click when you find the plug-inNow the installationbutton
  • When the installation is successful, clickTo enable theButton to activate the plug-in.

Modify the config.php configuration

You must ensure that WordPress understands that it is serving through the tunnel hostname. You can configure WordPress to include the following lines by modifying wp-config.php:

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
Copy the code
  • Open the wp-config. PHP file in the root directory of the website, add the above items, and save.

After configuration, see the following figure:

Now, our blog site can be accessed by the public network. Let’s see the effect:

Use HTTPS to access dev10.vip.cpolar. Cn /

Looking at the beautiful little lock in the red frame, I feel much better now. ^ ^

We have successfully set up the WordPress site.

Conclusion:

We created a new Web site, installed and configured the latest version of wordpress, and configured the public network tunnel, secondary subdomain name, and configured the theme style for the new site, you have a blog site belonging to your own, you can write blog, start your own journey of we-media.

In the next tutorial, we will continue to improve the configuration of the WordPress site and configure SSL for it. If you like it, please share it with your friends and stay tuned for the following chapters.

Welcome to learn more about CPolar