Chapter one: Preparatory work
Now the more popular blog communities are blog Park, Open Source China, Sifu, Nuggets, CSDN, Jianshu and so on. You can share and exchange relevant professional knowledge in your favorite community at ordinary times. If you want to have your own blog, let me know what we need to prepare. After all, personal blogs feel more like home.
There are many options for creating a personal blog. If you are not in the software development industry, it is recommended to create a static blog using GitHub Page. As a software developer, I will choose WordPress to build my personal blog, which can also consolidate the relevant knowledge, and the cost is not very much, after all, I am repairing my own home, why not build a little higher.
I. Rent cloud server and domain name
I choose Ali cloud server and register domain name on Ali cloud.
Server: service providers often have some activities, I was in the end of 18 years to rent, then bought 1 core 2G, 3 years price is 299 yuan, (it is recommended to buy a few years, or later renewal of the word or more expensive). It has been on hold for more than a year now.
Domain name: Domain name is relatively cheap, also, renewal will be a little more expensive than the first purchase. I registered the domain name.website at the end, and it cost 5 yuan.
Second, for the record
Visit beian.aliyun.com/ for filing. During the filing process, aliyun APP will be used to upload personal ID card information (here to ridicule aliyun app can not take clear ID card information). Record to fill in the information caught or more strict (blog, share, exchange and a series of words involving the industry or promotion can not appear), under normal circumstances if there is not in line with the requirements of filling in the content, Ali Cloud record members will contact you a day or so to modify. After the modification is completed, it will be submitted to the GENERAL Communications Authority for record. The filing period is usually 9 to 30 days. It took me 11 days to file.
General management bureau after the completion of the record there is a public security record. After the website is said to open, can receive a phone to let go to put on record. But I haven’t received a similar call yet.
Domain name resolution
Domain name resolution is relatively simple, a few pictures can be clear.
- Log in ali Cloud, enter the console, find the domain name, and click Resolve
- Click on the Beginner guide
- Website resolution, record the value to fill in your server public IP address
- Mailbox resolution, select a mailbox to resolve.
So the domain name is resolved, so let’s wait a few minutes and verify that it was resolved successfully. In Windows, run the CMD command and ping the domain name. If the resolution succeeds, the IP address is returned.
Chapter 2: Installing wordPress
In the previous chapter, we resolved the domain name to the server. In this chapter we will directly set up our blog, we will use Docker to install wordpress. If you don’t know how to use Docker, you can check out these two articles. Windows use docker to run mysql and other tools (a) Windows install Docker, Windows use docker to run mysql and other tools (two) install and run mysql.
The system used by our server this time is centos7.4.
Install Docker
Connect to the server and switch to user root.
1. View the centos kernel
uname -r // Check the kernel version.
Copy the code
The Centos version of Docker has requirements on the Centos system, the Centos system kernel version must be later than 3.10, otherwise, the Centos cannot support Docker. If the kernel version is earlier, upgrade the kernel first.
2. Download the docker
yum install -y docker / / download docker
Copy the code
3. Start the docker
service docker start / / start docker
Copy the code
4. Check the Docker running status
systemctl status docker // Check the docker running status
Copy the code
Running indicates that docker has been started successfully.
Mysql > run mysql
Pull image and possible problems will not be discussed here, has written a more specific article, have doubts small friends please check Windows use docker run mysql and other tools (two) install mysql.
** Please open the mapped port number, otherwise you cannot connect to the database. ** Of course, for security reasons, it is best not to open the database public network port ha.
Connect to the database and create a database called wordpress.
3. Run wordpress
1. Pull the wordpress image
docker pull wordpress:latest // Pull a wordpress image
Copy the code
2. Start the wordpress container
// Start wordpress and connect to mysql8.0 and give mysql8.0 a separate name dbDocker run --name mywordpress --link mysql8.0:db -p80:80 -d wordpress:latest
Copy the code
Ok, so we’re almost done here.
3. If you access the domain name, the following information is displayed:
After selecting the language, click Continue, the following page appears, and fill in the database information.
Moving on to the next step:
WordPress: cn.wordpress.com/
Gz is used for Unix operating systems, and ZIP is used for Windows operating systems. However, the WinRar tool can also decompress the tar.gz file in Windows operating systems. Well, there’s no more hesitation about downloading that file. Let’s download tar.gz
The Centos version of Docker has requirements on the Centos system, the Centos system kernel version must be later than 3.10, otherwise, the Centos cannot support Docker.
uname -r // Check the kernel version
yum install -y docker / / install docker
service docker start / / start docker
Copy the code
Chapter three: Decorating your blog
Now that we have the basics of the blog set up in the previous chapter, we will look at how to make some optimizations.
First, theme selection
You can log in to the wordpress background to select a theme, and then go to find your favorite theme to install, here we suggest you to search for some of your favorite themes in Baidu, download and import directly. I choose VT Blogging as the theme here, because I prefer a more concise blog theme, and this one fits me.
Second, add record number
When applying for the record, we must remember that Ali Cloud sent an email to say that after the construction of the station, the record number needs to be added. General official topics have a place to add the ICP record number in the Background general TAB. However, the THEME I use for VT Blogging does not. And so began the search. Where can I change this record number? Here are the steps:
-
Inside the Docker container
Sudo docker exec -it Container ID /bin/bash
-
Then ls takes a look at what directories are available
cd wp-content/themes/vt-blogging
Bash :vi: Command not found bash:vi: Command not found bash:vi: Command not found This is because the VI editor has not been downloaded.
The solution is
Ubuntu use apt-get update apt-get install -y vim centos use yum update yum install -y vim centosCopy the code
Finally, we found this information in the directory /inc/template-tags.php. So we’re going to mimic writing PHP, and we’re going to change the record information.
3. Recommend common plug-ins
- Enlighter – a programmer’s requirement with custom syntax highlighting plugins.
- WP Super Cache – WordPress fast Cache plugin, static pages. On the one hand, it can improve SEO ranking, on the other hand, it can improve the speed of blog access and relieve server pressure.
- Wp-pagenavi — Add more advanced paging navigation to your WordPress blog.
- Yoast SEO – the first truly versatile SEO solution for WordPress! Includes page content analysis, XML sitemap, and more.
- Wordfence — Security plugin, security is very important.
At present, my blog is still in continuous optimization, welcome everyone to visit and give advice. Blog Address:abin.website
If the article is helpful to you, please remember to like attention yo ~ welcome everyone to pay attention to my public number: byte legend, daily push technical articles for everyone to learn reference.