How to configure your own domain name for the WordPress blog site on the Raspberry Pi, and make it accessible from the external network?

How to configure your own domain name for the WordPress blog site on the Raspberry Pi, and make it accessible from the external network?

This article describes how to configure your own domain name for WordPress.

Preconditions

  • You already have a domain name of your own
  • If you haven't, please go to (Alibaba Cloud, Tencent Cloud, Xinwang, etc.) domain name providers to buy, now a domain name is very cheap.
  • A Raspberry Pi (2b, 3b, 4b are all acceptable)
  • WordPress installed
  • If not, please refer to the previous tutorial
  • cpolar already installed
  • If not, please refer to the tutorial " How to Build a Web Site on Raspberry Pi "
  • cpolar upgrade to professional package

In this example, assume that we already have our own domain name: bestexpresser.com, and want to dev.bestexpresser.combind the second-level domain name to the WordPress site we created on the Raspberry Pi.

The specific operation steps are as follows:

Step 1: Reserve a custom domain name in the background

Under the cpolar background –> 预留--> 保留自定义域名tab:

  • 地区Select from the drop-down menu United States, enter your domain name dev.bestexpresser.comas the reserved domain name, and click 保留the button. This guarantees that no one else can hijack your domain using their own tunnel.
  • img
  • img

Step 2: Configure your domain name DNS resolution

  • In your own domain name provider, add a CNAME record in DNS resolution. In this example: name = dev, value =5983fcc1.cname.cpolar.io
  • Assuming that the domain name in this example bestexpresser.comis registered in Alibaba Cloud, we need to log in to Alibaba Cloud, and add a record under the domain name 云解析DNSin the Alibaba Cloud console.bestexpresser.comCNAME

img

  • Set the record type to CNAME, and fill in the cname address provided by cpolar, click确认

img

  • After adding the effect, it takes 10 minutes for the analysis to take effect

img

Step 3: Test domain name resolution

  • After about 5-10 minutes, ping your custom domain name ( http://dev.bestexpresser.com ) to see if it has been resolved to the cname address provided by cpolar
ping dev.bestexpresser.com

img

  • If the address returned by ping contains the cname address of cpolar, it means that the resolution has been successful.

Step 4: Test run in the foreground terminal

cpolar http -hostname=dev.bestexpresser.com 80
  • As shown in the figure below, it means that the configuration is successful, and you can now use the http://dev.bestexpresser.com custom domain name to access the local site.

img

  • View the effect in the browser

img

  • Now, the site with our own domain name has been published on the public network.

Step 5: Modify the cpolar configuration file

nano /usr/local/etc/cpolar/cpolar.yml
  • We delete the line websitebelow the tunnel subdomainand add a line of hostnameparameters.
  • Configuration file before modification

img

  • Modified configuration file

img

  • Save configuration file and exit

Step 6: Test configuration file

  • Let's start a website tunnel separately on the command line to test it
cpolar start website
  • As shown in the figure, the configuration is successful

img

  • Restart the cpolar service
sudo systemctl restart cpolar

Summarize:

Now, you have successfully configured your own domain name and published the site to the public network.

Instructions for server region selection:

    • At present, there are cn, cn_vip, and cn_top regions in China
    • There are us and hk regions overseas
    • In domestic regions, all custom domain names need to be filed in advance before they can be deployed.
    • In foreign regions, filing is not required.

If your domain name has been filed, it can be deployed in the domestic region, and the domain name in the cn region will automatically pass the whitelist. For cn_vip and cn_top areas, if you need artificial domain names to pass the whitelist, please contact the QQ customer service on the official website and ask him to submit the whitelist application for you. If your domain name has not been filed and you can use the us and hk regions, you do not need to go through the whitelist step of the domain name.

Reprinted from the cpolar article: How to configure your own domain name for the WordPress blog site on the Raspberry Pi, and make it accessible from the external network?

Guess you like

Origin blog.csdn.net/w2915w/article/details/131959046