WordPress is a blog platform developed in PHP. This document describes how to manually build a private WordPress site on a Tencent Cloud CVM with CentOS 7.6.
To build a WordPress site, you must be familiar with common Linux commands, such as those for installing software through YUM in the CentOS environment. In addition, you need to know how to use the involved software programs and their version compatibility details.
The following software programs are used to build the WordPress site:
Log in to a Linux instance by using WebShell (recommended). You can also use either of the following login methods that you are comfortable with.
LNMP is the acronym for Linux, Nginx, MariaDB, and PHP. It is one of the most common runtime environments for web servers. After creating and logging in to a CVM instance, you can build an LNMP environment by referring to Manually Building an LNMP Environment (CentOS 7).
The user authentication method varies depending on the MariaDB version. For details, visit the MariaDB official website.
mysql
wordpress
in this example:CREATE DATABASE wordpress;
user
user with the password 123456
in this example:CREATE USER 'user'@'localhost' IDENTIFIED BY '123456';
user
all permissions to the wordpress
database:GRANT ALL PRIVILEGES ON wordpress.* TO 'user'@'localhost' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
\q
root
accountmysql
root
:MariaDB 10.4 for CentOS allows the
root
account to log in without a password. Run the following command to set a password forroot
and save it in a safe place:
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('Enter your password');
\q
You can download the latest version of WordPress from the official WordPress website.
index.php
file that is used to test PHP-Nginx configuration from the root directory of the website:rm -rf /usr/share/nginx/html/index.php
/usr/share/nginx/html/
directory and download and decompress the WordPress installation package:cd /usr/share/nginx/html
wget https://cn.wordpress.org/wordpress-5.0.4-zh_CN.tar.gz
tar zxvf wordpress-5.0.4-zh_CN.tar.gz
Run the following commands to navigate to the WordPress installation directory, copy the content of the wp-config-sample.php
file to the wp-config.php
file, and save the original configuration file for backup:
cd /usr/share/nginx/html/wordpress
cp wp-config-sample.php wp-config.php
Run the following command to open and edit the new configuration file:
vim wp-config.php
Press i to enter the editing mode. Find the MySQL section in the file and modify the settings as described in Configuring the WordPress database.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'user');
/** MySQL database password */
define('DB_PASSWORD', '123456');
/** MySQL hostname */
define('DB_HOST', 'localhost');
After finishing the modification, press Esc and enter :wq. Then, save the changes and close the file.
In the address box of the browser, enter http://<Domain name or public IP address of the CVM instance>/<WordPress folder>
, for example:
http://192.xxx.xxx.xx/wordpress
Press Enter to go to the WordPress installation page and configure WordPress.
Complete the following installation information as instructed in the WordPress installation wizard. Then, click Install WordPress.
Required information | Description |
---|---|
Site title | WordPress site name |
Username | WordPress administrator name. For security purposes, use a name other than admin, which is prone to be cracked. |
Password | Use the default strong password or a custom password. Do not use previous passwords and save the password in a secure place. |
Email address | Email address for receiving notifications |
You can set a domain name for your WordPress site. In this way, users can use the domain name instead of a complex IP address to visit your site. If you are building the site for learning purposes, you can set an IP address for the site. However, this practice is not recommended for other cases.
If you encounter issues when using a CVM, refer to the following documents for troubleshooting based on your actual situation.
Was this page helpful?