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 (Ubuntu 18.04)
Copy page
Download PDF
Setting up a WordPress blog website (Ubuntu 18.04)
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, Ubuntu 18.04 is used.​
  • WordPress: In the example provided in this topic, the latest version of WordPress 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 (Ubuntu 18.04) and Setting up an LNMP environment (Ubuntu 18.04).​
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 MariaDB database as the root user. The password of the root user is the one you specified during the configuration of 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.* 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 MriaDB database.​
  • ​
    exit​
    ​
Step 2: Set up a WordPress website​
  1. Execute the following command to download the latest version of WordPress to the website root directory of Nginx. Visit the official WordPress website to obtain the download path.​
  • ​
    cd /var/www/html/​
    wget https://wordpress.org/latest.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 -xvf latest.tar.gz​
    ​
  1. Execute the following commands in sequence to allow WordPress to upload images.​
  • ​
    chown -R www-data:www-data /var/www/html/wordpress​
    chmod -R 755 /var/www/html/wordpress​
    mkdir /var/www/html/wordpress/wp-content/uploads​
    chown -R :www-data /var/www/html/wordpress/wp-content/uploads​
    ​
  1. Modify the WordPress configuration file to associate WordPress with the database.​
  1. Back up the configuration files 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 dababase section.​
  • ​
    // ** Database settings - You can get this info from your web host ** //​
    /** The name of the database for WordPress */​
    define('DB_NAME', 'WordPress_database_name');​
    ​
    /** Database username */​
    define('DB_USER', 'MariaDB_username');​
    ​
    /** Database password */​
    define('DB_PASSWORD', 'MariaDB_password');​
    ​
    /** Database 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 and select a language.​
  • 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