banner
胡鹤仙的Blockchain Blog

胡鹤仙的Blockchain Blog

twitter
github
telegram
medium

A detailed tutorial on "Building a Blog from 0 to 1"

Remember a riddle: how many steps does it take to put an elephant in a refrigerator? Three steps: open the refrigerator, put the elephant inside, and close the refrigerator.

The steps for setting up a personal blog can also be summarized in three steps: register a domain name, purchase a server, and build the blog. However, when we actually get to work, there are far more steps than we imagine.

Today, I am writing a tutorial on building a blog from 0 to 1, hoping to inspire more people who want to write blogs.

image

Disclaimer: I am only sharing my experiences and recommending the servers and programs I use. There are many better options available, so please refrain from criticism if you disagree.

This tutorial is not written because I have nothing else to write about; on the contrary, I hope that this tutorial will enable those who want to write blogs to do so.

Basic Concepts#

Before introducing how to build a blog, it is necessary to explain the relevant concepts. Here, I have modified the explanation from Chuzhiyin.

To visit my blog, you need to enter the domain name yinji.org in your browser. The browser queries the domain resolution service to find that the above URL points to the IP address 64.88.88.xx. The IP address is bound to the server, so accessing the IP means accessing the server. The server finds that yinji.org points to the directory where the WordPress blog program is located, and thus returns all displayable files in that directory. Finally, the blog program returns the content to the visitor, which is displayed in the browser.

Therefore, we need a domain name, a server, a domain resolution service, an IP address, a blog program, and a runtime environment.

Domain Name#

A complete domain name consists of a prefix and a suffix, such as yinji.org, where yinji is the prefix and org is the suffix, linked by the symbol .. So when registering a domain name, think of the prefix in advance and then choose a suitable or preferred suffix from the available options.

Common suffixes include .com, .net, .org, .me, and .top. The country-specific domain suffix .cn is not recommended. If used for a personal blog, I recommend using .com, .net, .me, or .im.

Registering a domain name with domestic service providers has the advantage of lower prices and convenient payment, but it requires real-name authentication. I suggest using foreign domain registrars, depending on personal choice.

Recommended domestic domain service providers include Tencent Cloud and Alibaba Cloud. If you want to register a non-mainstream domain suffix, you can use QuDomain. Recommended foreign domain service providers include Name, NameCheap, NameSilo, Porkbun, and Gandi. Before using them, you can refer to comparison websites to compare registration, renewal, and transfer prices for different domain suffixes at different domain service providers, such as Nazhumi, TLD-List, and NameBeta, and try to choose well-known large companies.

Server#

There is a difference between cloud servers and VPS, but they are also related. For ease of understanding, I will introduce VPS here.

When using domestic VPS, the domain must be filed, so if you plan to purchase VPS from domestic cloud service providers like Tencent Cloud, Huawei Cloud, or Alibaba Cloud, it is best to register the domain with the same provider for easier management and filing.

If you use VPS outside of mainland China, such as servers in Hong Kong, Taiwan, Japan, or the United States, there is no need for filing.

Generally, domestic VPS has smaller bandwidth and lower prices, while VPS in other regions has larger bandwidth and slightly higher prices, but there are also cost-effective providers, which will be introduced later.

Tencent Cloud, Alibaba Cloud, and Huawei Cloud all have corresponding student certification services, allowing you to purchase reasonably configured VPS at discounted prices if you meet the criteria.

There are many foreign cloud service providers to choose from, with well-known ones including AWS, Vultr, Linode, and Bandwagon Host. They provide good quality servers and after-sales service, but they are also quite expensive, so I do not recommend them for beginners. If your annual budget is under 300 yuan, I recommend CloudCone or RackNerd.

The VPS I currently use is from CloudCone, purchased during Easter in April 2023, with a configuration of CPU & Memory: 2 cores (vCPU) & 2GB, Storage: 60GB hard disk, Bandwidth: 1Gbps, 3TB traffic per month, for $25.5/year, with the same price for renewal. For the usage experience, you can check my previous article “The 7th Month of Using CloudCone”.

By the way, another important advantage of foreign cloud service providers is that the renewal price is the same, unlike domestic cloud services, which often only offer discounted prices for newcomers and the first year.

Purchasing VPS is similar to registering a domain name; choose well-known providers. Although the two I recommend are not as famous as big companies like AWS and Vultr, they are also quite well-known in the community and offer good value for money.

Building the Blog#

Purchasing the Server#

Using CloudCone as an example, I will introduce the process from purchasing the server to building the blog.

First, register an account on CloudCone. This service provider requires you to pre-charge an amount, so check the price of the VPS you want to buy and recharge the corresponding amount. Click on your avatar, then go to the Billing page.

image

There is an Add funds button below, which supports Alipay payments.

image

After recharging the amount, take the Christmas special VPS priced at $26 as an example, then go to the purchase page, select the appropriate system, set the Hostname, and you can place the order.

image

image

I recommend using Debian or Ubuntu systems, selecting the latest version. The Hostname has no strict requirements; a combination of letters and numbers is sufficient. Then wait for the VPS to be successfully activated, after which you will receive an email notification from CloudCone containing the VPS's IP address and SSH login account and password.

image

Resolving the Domain Name#

Generally, domain registrars provide free domain resolution services, or you can use domain resolution services provided by other providers, such as Cloudflare.

Here, I will introduce using Cloudflare as an example. First, you need to register a Cloudflare account and log in, then click to add a site.

image

After entering the domain name to be added, select the Free plan at the bottom and click continue. You will be prompted to modify the DNS servers for the domain name. Then, just return to the domain registrar's backend and modify the DNS servers.

image

Wait for the DNS server update to complete, then return to the Cloudflare backend to add resolution for the domain name. Select type A, fill in the name as @ or www, and enter the IPv4 address of the VPS you purchased above. It is not recommended to use Cloudflare proxy for the proxy status, as it is generally unnecessary; it is advisable to cancel it, and finally click save.

Regarding the name, let me elaborate a bit. For my domain yinji.org, if you fill in @, the resolved domain will be yinji.org; if you fill in www, the resolved domain will be www.yinji.org. It is recommended to resolve both, using yinji.org as the main domain and setting www.yinji.org to redirect to yinji.org.

image

Installing the Environment#

To install the blog using the WordPress program, my common practice is to install the Baota panel, which configures the lnmp environment with one click: Linux + Nginx + MySQL + PHP.

First, you need to log in to the server using any SSH client, entering the account root and the login password, with the port usually being 22. If your computer is running Windows, you can directly enter the command ssh [email protected] -p 22 in the Terminal to log in to the server.

The following image is a screenshot of the Baota remote tool; just enter the corresponding information to log in.

image

The commands for installing the Baota panel vary depending on the system, so refer to the official website of Baota.

For CentOS:

yum install -y wget && wget -O install.sh https://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec

For Ubuntu:

wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec

For Debian:

wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh ed8484bec

image

You only need to enter one line of command, and the entire process is mostly automated. After successful installation, the panel login address and account password will be displayed; save them and exit.

Log in to the Baota panel using the provided address and account password. A choice for environment installation will pop up, generally selecting LNMP for a quick installation.

image

Once the above steps are completed, the environment required for building the WordPress blog will be successfully installed.

Creating the Website#

There are many types of blog programs, with common ones being WordPress and Typecho. Here, I will take WordPress as an example. First, go to the official website of WordPress to download the program package, which includes a compressed package with Chinese language support.

image

Next, return to the Baota panel, find the "Website" section on the left, add a site → create a site → enter the domain name (e.g., yinji.org) → database (select MySQL, set the account and password) → PHP version (select PHP-81), and finally click submit.

Note: This step creates both the website directory and the database, so there is no need to create the database again later. Just remember the database name, account, and password from this step.

After creating a new site, click on "Files" on the left, and you will see that the system has automatically created a folder named after the domain name, which we call the website root directory.

image

image

After the site is created, enter the directory where the site is located and delete all files in the directory. Generally, only a .user.ini file remains, which can be left if it cannot be deleted.

Upload the downloaded WordPress compressed package and extract it to get a folder named WordPress. Move all the files inside this folder to the website root directory.

image

Once the above steps are completed, you can generally enter the domain name in the browser to install the program. However, to reduce future troubles, you can set up SSL and pseudo-static settings in advance.

Click on the newly created site, select SSL on the left, then choose Let's Encrypt, select the domain name that needs to be configured for the SSL certificate, and click apply.

image

image

Finally, enable forced HTTPS and click save.

Setting up pseudo-static is also very simple. Open "Pseudo-static" on the left, scroll down to find WordPress, and click save.

image

After setting up SSL and pseudo-static, you can enter the bound domain name in the browser to enter the WordPress program installation phase.

Installing the WordPress Program#

Enter the domain name in the browser to access the program installation interface.

image

This step requires the database name, database account, and database password, all of which can be found in the Baota panel. Keep the database host and table prefix as default; no need to modify them.

image

After filling in the correct information, submit it. The next page will ask you to set the site title, backend username, password, and other details.

image

Once all the information is filled out, you can access the blog backend through the path domain/wp-admin and see the interface shown in the following image, indicating that the blog has been successfully built.

image

What you need to do next is to familiarize yourself with WordPress, exploring articles, media, pages, comments, and how to upload/change themes, install plugins, and other functions.

Final Thoughts#

WordPress is the first program I came into contact with, and Baota is also the first visual server panel I used. Therefore, my long-standing blog building solution has been VPS + Baota + WordPress. There are alternatives, such as 1panel, or directly using the command line to install the environment manually, but I do not know how to do that, and it is also relatively difficult to learn.

I choose the most convenient method for myself. Even if some say WordPress is bloated, or that static blogs are better, or that the Baota panel has too many ads, it ultimately comes down to personal choice. Do well in your own way without imposing expectations on others.

Thus, all the content above is based on my personal experience and is highly subjective, merely serving as an option for those who want to build an independent blog for writing. At the same time, due to my limited abilities and knowledge, if there are any issues with the above content, please feel free to correct me.

As the blogger Xiao E from Dongping Xijiu said: in this increasingly restless environment, it is rare for non-technical people to take the time to start writing independent blogs again. Blogging has never been exclusive to technical people; non-technical individuals can also build their own independent blogs through learning and effort. I hope my content can help these people.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.