Build a WordPress blog site and initialize blog settings

Spread the love

Building a WordPress Blog

This article uses Docker Compose to build a WordPress blog

This allows you to build a blog in a lightweight way, using the least memory and performance to build a complete WordPress blog

At the same time, it can achieve complete isolation of business and data, and facilitate subsequent blog backup and migration. The entire website can be backed up and migrated without relying on WordPress plug-ins, and it is open source and free

A WordPress requires about 500M of memory. In theory, the 8GB memory of Orange Pi 3B can build 10 WordPress blogs

docker-compose.yml file

version: '3.3'
services:
   db_domain_xxx:
     image: mariadb:latest
     volumes:
       - ./db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: domain_xxx
       MYSQL_DATABASE: domain_xxx
       MYSQL_USER: domain_xxx
       MYSQL_PASSWORD: domain_xxx
   wordpress_domain:
     depends_on:
       - db_domain_xxx
     image: wordpress:latest
     ports:
       - "3065:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db_domain_xxx:3306
       WORDPRESS_DB_USER: domain_xxx
       WORDPRESS_DB_PASSWORD: domain_xxx
       WORDPRESS_DB_NAME: domain_xxx
     volumes:
       - ./wordpress:/var/www/html
volumes:
    db_data: {}

Fix the problem of missing style files

Add the following code at the bottom of wp-config.php in the wordpress folder (add it above the following code):

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Code to be added
https://xxx.domain.com is your own blog domain name

$_SERVER['HTTPS'] = 'on';
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
define('WP_HOME', 'https://xxx.domain.com');
define('WP_SITEURL', 'https://xxx.domain.com');

if (
    (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ||
    (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
) {
    $_SERVER['HTTPS'] = 'on';
}

Blog Settings

Recommended installation order to set

Fill in WordPress subtitle

Set the link format of the article (url title format)

Change the blog theme (the following data statistics code and advertising code and other component codes are dependent on the theme) (the theme of this blog is TheSimplest)

Add Google Kit plugin (Site Kit by Google) (Also remember to delete WordPress default plugins, Koli and comment plugins, etc.)

Add article visit statistics plugin (WP-PostViews) (Note that this plugin has not been updated for two years)

Add umami statistics code in the head tag of header.php in the theme editor

Add Google advertising code in the head tag of header.php in the theme editor

Add sidebar custom html code in Widgets (set Google advertising code)

Modify the bottom copyright statement and add Google advertising code in footer.php in the theme editor

Delete the default article and add a new article (such as this article)

Tips

This article eliminates the process of deploying FRP on cloud servers and local servers

Omits the process of CloudFalre setting up domain name DNS resolution

Omits the process of setting up domain name Nginx and SSL certificate and reverse proxy in the aapanel panel

Omits the detailed setting process of the above 10 steps

Omits the process of setting up Google ad code and umami self-deployment and umami code

Omits the process of writing new articles using the Gutenberg editor

END.

Leave a Reply

Your email address will not be published. Required fields are marked *