banner
胡鹤仙的Blockchain Blog

胡鹤仙的Blockchain Blog

twitter
github
telegram
medium

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

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 building a personal blog can also be summarized in three steps: register a domain name, purchase a server, and set up the blog. However, when we actually operate, the steps are far more 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

Anti-trolling statement: I am only basing my recommendations and introductions on my own experience with the servers and programs I use. There are many better solutions, so please refrain from criticism if you disagree.

This tutorial is not written because there is 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 the browser. The browser queries the IP address pointed to by the domain name through the domain name resolution service, which is 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 the 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 name 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, while country-specific domain suffixes like .cn are not recommended. For personal blogs, I recommend using .com, .net, .me, or .im.

Registering a domain name with domestic service providers is beneficial because the prices are relatively cheap and payment is convenient, but real-name authentication is required. 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 non-mainstream domain suffixes, you can use QuDomain. Recommended foreign domain service providers include Name, NameCheap, NameSilo, Porkbun, and Gandi. Before using, 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 and a connection between cloud servers and VPS. For ease of understanding, I will introduce VPS here.

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

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

Generally speaking, domestic VPS has smaller bandwidth and cheaper 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. Through student certification, you can purchase reasonably configured VPS at a discounted price. If you meet the conditions, you can give it a try.

There are many foreign cloud service providers, 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 the Easter period in April 2023, with a configuration of CPU & Memory: 2 cores (vCPU) & 2GB, Storage: 60GB hard disk, Bandwidth: 1Gbps, 3TB traffic per month, at $25.5/year, with the same price for renewal. As 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 remains the same, unlike domestic cloud services, which often only offer discounted prices for newcomers and the first year.

Purchasing a VPS is similar to registering a domain name; choose well-known providers. Although the two I recommend may not be as famous as big companies like AWS or Vultr, they are also relatively well-known in the industry and offer good cost performance.

Building a Blog#

Purchasing a Server#

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

First, register an account on CloudCone. This 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, supporting Alipay payments.

image

After recharging the amount, take the Christmas special VPS for $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

It is recommended to use Debian or Ubuntu systems, and choose the latest version. The Hostname does not have many restrictions; 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 other service providers like Cloudflare for domain resolution.

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, click continue, and it will prompt you to change the DNS servers for the domain name. Then you just need to go back to the domain registrar's backend and change 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; generally, it is not needed, so 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 generally 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 content to log in.

image

The commands used to install the Baota panel vary for different systems, based on what is provided on the Baota official website.

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.

Using the provided address and account password, log in to the Baota panel, and a selection for environment installation will pop up. Generally, choose LNMP for a quick installation.

image

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

Creating a Website#

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

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, there will only be a .user.ini file left, which can be ignored if it cannot be deleted.

Upload the downloaded WordPress compressed package and extract it, resulting in 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 in advance.

Click on the website you just created, 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, and password, among other details.

image

Once all the content is filled in, you can access the blog backend through the path domain/wp-admin, where you will see the interface shown in the following image, indicating that the blog setup is complete.

image

From here, all you need to do is familiarize yourself with WordPress, exploring articles, media, pages, comments, and how to upload/change themes and install plugins.

Final Thoughts#

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

I choose what is convenient for me. Even if some people 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 your best and do not impose expectations on others.

Thus, all the content above is based on my personal experience, which is highly subjective and merely serves as an option for those who want to build an independent blog for writing. Additionally, 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 individuals 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.