You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Building a WordPress blog
Setting up a WordPress blog website (CentOS 7)
Copy page
Download PDF
Setting up a WordPress blog website (CentOS 7)
WordPress is a blogging platform developed by using PHP. It can be deployed on an ECS instance that supports PHP and MySQL databases to create your own website or function as a content management system.​
Software versions​
  • Operating system: In the example provided in this topic, CentOS 7.6 is used. You can also use CentOS 7.9, veLinux 1.0 (CentOS compatible version), or other CentOS 7 series images.​
  • WordPress: In the example provided in this topic, WordPress 5.8.1 is used.​
Prerequisites​
A Linux instance is purchased and a LAMP or LNMP environment is set up. For more information, see Setting up a LAMP environment (CentOS 7) and Setting up an LNMP environment (CentOS 7).​
Step 1: Configure a database for WordPress​
  1. Remotely connect to and log in to the ECS instance. For more information, see Logging in to Linux instances.​
  1. Execute the following command to access the MySQL/MariaDB database as the root user. The password of the root user is the one you specified during the configuration of MySQL/MariaDB.​
  • ​
    mysql -u root -p​
    ​
  1. Execute the following command to create a database for the WordPress blogging platform.​
  • ​
    create database database_name;​
    ​
  1. Create a user for the database created for WordPress.​
  • ​
    create user 'username'@'localhost' identified by 'Password';​
    ​
  1. Grant all permissions to the user.​
  • ​
    grant all privileges on database name.* to 'Username'@'localhost';​
    ​
  1. Execute the following command to make the preceding commands take effect.​
  • ​
    flush privileges;​
    ​
  1. Execute the following command to exit the MySQL/MariaDB database.​
  • ​
    exit​
    ​
Step 2: Set up a WordPress website​
  1. Execute the following command to download WordPress to the website root directory of Nginx. Visit the official WordPress website to obtain the download path.​
  • ​
    cd /var/www/html​
    wget https://cn.wordpress.org/wordpress-5.8.1-zh_CN.tar.gz​
    ​
tip​
Replace /var/www/html with the website root directory you specified when you set up LNMP or LAMP.​
  1. Execute the following command to decompress the installation package.​
  • ​
    tar -vzxf wordpress-5.8.1-zh_CN.tar.gz​
    ​
  1. Modify the WordPress configuration file.​
  1. Back up the configuration file in the configuration file directory.​
  • ​
    cd wordpress​
    cp wp-config-sample.php wp-config.php​
    ​
  1. Execute the following command to modify the configuration file.​
  • ​
    vim wp-config.php​
    ​
  1. Press the i key to enter edit mode and modify the following content in the MySQL section.​
  • ​
    // ** MySQL settings - You can get this info from your web host ** //​
    /** The name of the database for WordPress */​
    define('DB_NAME', 'WordPress_database_name');​
    ​
    /** MySQL database username */​
    define('DB_USER', 'MySQL_name');​
    ​
    /** MySQL database password */​
    define('DB_PASSWORD', 'MySQL_password');​
    ​
    /** MySQL hostname */​
    define('DB_HOST', 'localhost');​
    ​
  1. Press Esc, enter :wq, and then press Enter to save the modifications and close the file.​
Step 3: Log in to the WordPress website​
  1. Enter http://<ECS instance EIP>/wordpress in your local browser to access the WordPress website.​
  • If the following output is displayed, WordPress is set up successfully.​
  1. Enter the basic information of the website, and then click the "Install WordPress" button.​
  • ​
    Information​
    Description​
    Site name​
    The name of the WordPress website.​
    Username​
    The username for logging in to the WordPress website.​
    Password​
    The password for logging in to the WordPress website.​
    Your email address​
    The email address for receiving notifications.​
    ​
  1. Click the "Log in" button.​
  1. Enter your username and password to log in to the WordPress website.​
  • The following output is displayed.​
Step 4 (Optional): Resolve the WordPress domain name​
You can configure a domain name for your website, eliminating the need to use a complex, less secure EIP to access it. You can perform the following steps to specify a domain name for the website.​
  1. Purchase a domain name.​
  1. Apply for an ICP filing for your domain name.​
  • If your domain name points to a server located in the Chinese mainland, you need to apply for an ICP filing for your domain name. Otherwise, the website is not accessible.​
  1. Configure domain name resolution.​
  • You need to resolve your domain name to the EIP to access your website.​
  1. After you complete the preceding steps, you can enter http://<domain name> in your local browser to access the WordPress website.​
Step 5 (Optional): Enable HTTPS for the website​
When a user accesses your website over the HTTP protocol, the browser warns the user that the connection is not secure. We recommend that you enable HTTPS secure communication for your website. This ensures encrypted data transmission between users and your website, effectively defending against network hijacking, information leakage, and other threats.​
To enable HTTPS, you need to deploy an SSL certificate on your website. You can apply for a free SSL certificate in the Volcano Engine Certificate Center. For more information, see Applying for free certificate and Downloading and installing certificate.​
Last updated: 2026.06.18 19:52:58