Article Directory
-
- How to configure your own domain name for the WordPress blog site on the Raspberry Pi, and make it accessible from the external network?
-
- **Preconditions**
- The specific operation steps are as follows:
- Step 1: Reserve a custom domain name in the background
- Step 2: Configure your domain name DNS resolution
- Step 3: Test domain name resolution
- Step 4: Test run in the foreground terminal
- Step 5: Modify the cpolar configuration file
- Step 6: Test configuration file
- Summarize:
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.com
bind 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 menuUnited States
, enter your domain namedev.bestexpresser.com
as the reserved domain name, and click保留
the button. This guarantees that no one else can hijack your domain using their own tunnel.
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.com
is registered in Alibaba Cloud, we need to log in to Alibaba Cloud, and add a record under the domain name云解析DNS
in the Alibaba Cloud console.bestexpresser.com
CNAME
- Set the record type to
CNAME
, and fill in the cname address provided by cpolar, click确认
- After adding the effect, it takes 10 minutes for the analysis to take effect
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
- 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.
- View the effect in the browser
- 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
website
below the tunnelsubdomain
and add a line ofhostname
parameters. - Configuration file before modification
- Modified configuration file
- 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
- 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?