How I Build My WordPress in 2021

I believe that all who praise their rights of speaking should own their personal WordPress sites. It is the best time for public speaking because you can share your moments or tweets easily. Nevertheless, it is also the worst time for public speaking because you have given up your accounts’ ownership. Geeks embrace freedom and worry about Big Brother. Therefore, I build my WordPress site.


This time, I adopt the traditional way to build my WordPress. The prerequisites include a server on Tencent Cloud installed with Ubuntu 18.04 LTS and a domain name with “record.” Moreover, I decide to use a MySQL instance on Cloud because I do not want my server to crash easily. I had little knowledge of PHP before. I understood it heavily relies on Apache Server (but I am a big fan of Nginx instead). Surprisingly, the installation process is smooth and easy. Let’s have a look!

First, install the software:

sudo apt update
sudo apt install php7.2-cli php7.2-fpm php7.2-mysql php7.2-json php7.2-opcache php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl

The next step is creating a folder for our PHP and WordPress. And we download WordPress’s source code and move it to the new directory.

sudo mkdir -p /var/www/html/
cd /tmp
tar xf latest.tar.gz
sudo mv /tmp/wordpress/* /var/www/html/
sudo chown -R www-data: /var/www/html/

We need to configure our Nginx. I use vim to add a new configuration file.

sudo vim /etc/nginx/conf.d/wordpress.conf

And click “i” to trigger the insert mode. Paste the following configuration (Please replace all with your domain name and also pay attention to the ssl_certificate path):

# Redirect HTTP -> HTTPS
server {
    listen 80;

    return 301$request_uri;

server {
    listen 443 ssl http2;

    root /var/www/html/;
    index index.php;

    # SSL parameters
    ssl_certificate /etc/nginx/conf.d/;
    ssl_certificate_key /etc/nginx/conf.d/;

    # log files
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;

    location = /favicon.ico {
        log_not_found off;
        access_log off;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;

    location / {
        try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires max;
        log_not_found off;


Save the configuration with ESC, :wq, ENTER. Then, reload your Nginx.

sudo service nginx reload

Great! Now you are on half way! The remaining things are easy ones.

  1. Create or buy your SSL certificates and move them to /etc/nginx/.
  2. Open your browser and go to your domain name.
  3. You can configure everything on the browser then. For the MySQL database part, you can input your cloud MySQL configuration there.

Tricks You Should Know

Here are some important tricks.

If you want to raise the upload size of your PHP, like if you’re going to install a new theme like me, then you need the following steps:

sudo vim /etc/php/7.2/fpm/php.ini

Then, use /max_size to search for post_max_size and increase it. Adopt the same method to increase upload_max_filesize as well.

Furthermore, I also configure CDN for it 🙂 I will explore more new features of WordPress and update in the following list:

  • Get started with Google Analytics and SEO plugin (2021-03-20)
  • Configure robots.txt. (PS: You need to rewrite /robots.txt to /?robots=1; ) (2021-03-20)

Need Help? Contact Me!

I am delighted to help you! If you would like to have a hands-on tutorial or set up your own WordPress without too much trouble, you can contact me:

This is the post I reference in Chinese:

Leave a Reply

Your email address will not be published.