All Products
Search
Document Center

Elastic Compute Service:Build a WordPress website on a Windows instance

Last Updated:Dec 26, 2024

WordPress is a free, open-source content management system (CMS) that allows you to easily create and manage websites, including blogs, news websites, e-commerce websites, and social media platforms. WordPress has a rich library of themes and plug-ins that allows you to customize the appearance and functionality of your websites. This topic describes how to build a WordPress website on an Elastic Compute Service (ECS) instance that runs a Windows operating system.

Preparations

Before you build a WordPress website on an existing ECS instance, make sure that the instance meets the following requirements:

  • The Linux ECS instance is assigned a static public IP address (also called system-assigned public IP address or auto-assigned public IP address) or associated with an elastic IP address (EIP).

    If the Linux ECS instance is not associated with a static public IP address, associate an EIP with the instance. For more information, see Associate one or more EIPs with an instance.

  • Inbound rules are added to a security group of the ECS instance to open ports 80 and 3389. For information about how to add a security group rule, see Add a security group rule.

    Important

    To ensure security, configure rules in a security group of the ECS instance to open ports based on your business requirements. For example, if you want to connect to a MySQL database on the ECS instance, configure an inbound rule in a security group of the instance to open port 3306, which is the default port for MySQL.

Procedure

This section describes how to build a WordPress website on an ECS instance that runs Windows Server 2022. The graphical interface may vary based on the Windows operating system version.

Step 1: Build a WIMP environment

WIMP stands for Windows, Internet Information Services (IIS), MySQL and PHP.

Important

Each WordPress version requires specific PHP and MySQL versions. If the PHP or MySQL version is incompatible with the WordPress version that you want to install, WordPress may fail to be installed. For information about the PHP and MySQL versions that are compatible with each WordPress version, see WordPress Compatibility. In this example, WordPress 6.4.4, IIS 10.0, MySQL 8.0, and PHP 8.0 are used.

Step 2: Build a WordPress website

  1. Connect to the Windows instance on which you want to build a WordPress website and download the WordPress installation package.

    1. Connect to the ECS instance.

      For more information, see Use Workbench to connect to a Windows instance over RDP.

    2. Download the WordPress 6.4.4 installation package from the official WordPress website.

      Note

      In this tutorial, WordPress 6.4.4 is used. Visit the official WordPress website for other WordPress versions. If you download the WordPress installation package on an instance that is located in a region inside the Chinese mainland and the 429 Too Many Requests error is reported, we recommend that you try again or download the WordPress installation package from a third-party website.

    3. Decompress the WordPress installation package.

      In this tutorial, the WordPress installation package is decompressed to the C:\wordpress-6.4.4\wordpress directory.

  2. Create a MySQL database for the WordPress website that you want to build.

    1. Go to the bin folder in the MySQL installation directory, right-click a blank area while you press and hold the Shift key, and then select Open command window here.

      In this example, the bin folder in the MySQL installation directory is C:\BtSoft\mysql\MySQL8.0.

    2. Log on to MySQL.

      .\mysql -u root -p

      Enter the password of the root user of MySQL as prompted.

    3. Create a database named wordpress.

      create database wordpress;
  3. Configure WordPress.

    1. In the C:\wordpress-6.4.4\wordpress directory, find the wp-config-sample.php file, copy the file, and then change the name of the file copy to wp-config.php.

    2. Use the text editor to open the wp-config.php file, modify information about the wordpress database, and then save the file.

      The following figure shows an example on how to modify the information.

      image

  4. Add the WordPress website to Server Manager.

    1. Open the Start menu on the Windows desktop. In the Windows Server section, click Server Manager.

      image

    2. In the top navigation bar of the Server Manager window, choose Tools > Internet Information Services (IIS) Manager.

      1

    3. In the Connections pane, choose <ECS instance name> > Sites.

    4. Delete the website that is bound to port 80 or change the port number from 80 to an unused port number, such as 8088.

      In this example, the website named 127.0.0.1, which is bound to port 80, is deleted.

      image

    5. In the right-side Actions pane, click Add Website to add the WordPress website.

      The following figure shows an example on how to configure parameters in the Add Website dialog box.

      image

      Take note of the following parameters:

      • Site name: Specify a name for the WordPress website. In this example, enter wordpress.

      • Physical path: Select the directory in which you decompressed the WordPress installation package. In this example, select C:\wordpress-6.4.4\wordpress.

      • Port: Enter 80.

  5. Install WordPress and log on to the WordPress website.

    1. On the Windows instance, use a web browser to access http://localhost/ to go to the WordPress installation page.

    2. Configure basic information about the WordPress website and click Run the installation.

      Configure the following parameters:

      • Site Title: the name of the WordPress website. Example: demowp.

      • Username: the username that you want to use to log on to WordPress. Make sure that the username is secure. Example: testwp.

      • Password: the password that you want to use to log on to WordPress. We recommend that you specify a strong password.

      • Your Email: the email address that you want to use to receive notifications. Example: example.com.

    3. Click Install Wordpress.

    4. Enter the username and password that you specified when you installed WordPress and click LOGIN.

      You are logged on to the WordPress website. For more information about how to use WordPress, see the WordPress documentation.

      image

Related operations

Configure a domain name for the WordPress website

If you allow users to access the WordPress website by using the public IP address of the ECS instance on which the WordPress website is built, the security of the instance is compromised. To improve security, configure a domain name for the WordPress website. If you have a domain name or want to register a domain name for the WordPress website, perform the following steps:

  1. Register a domain name.

    You can register a domain name on Alibaba Cloud. For more information, see Register a domain name on Alibaba Cloud.

  2. Apply for an Internet Content Provider (ICP) filing for the domain name.

    If the WordPress website is built on an ECS instance that is located in a region inside the Chinese mainland, apply for an ICP filing for the domain name before you use the domain name for the WordPress website. For more information, see ICP filing process.

    Note
    • You can apply for an ICP filing for the domain name of a website hosted on an ECS instance only if the instance is a subscription instance that has a subscription duration of at least three months. If the ECS instance on which the WordPress website is built does not meet the preceding requirements, perform one of the following operations:

    • The entire ICP filing process requires 1 to 22 business days to complete. The actual amount of time required may vary.

    • For the frequently asked questions about the ICP filing process, see FAQ.

  3. Resolve the registered domain name

    to the public IP address of the ECS instance. For more information, see Get Started.

    Note

    For the answers to frequently asked questions about the DNS resolution issues, see FAQ about DNS resolution issues.

  4. Replace the public IP address of the ECS instance with the registered domain name.

    1. Connect to the ECS instance on which the WordPress website is built.

      For more information, see Methods for connecting to an ECS instance.

    2. Go to the C:\BtSoft\mysql\MySQL8.0\bin folder in the MySQL installation directory, right-click a blank area while you press and hold the Shift key, and then select Open command window here.

      1

    3. Log on to MySQL.

      mysql -u root -p

      Enter the password of the root user of MySQL as prompted.

    4. Switch to the database for WordPress.

      use wordpress;
    5. Configure the registered domain name for the WordPress website.

      Note

      Replace http://www.example.com in the command with the actual domain name.

      update wp_options set option_value = replace(option_value, 'http://localhost', 'http://www.example.com') where option_name = 'home' OR option_name = 'siteurl';
    6. Exit MySQL.

      exit;

      The registered domain name is configured for your WordPress website.

FAQ

Why am I unable to access the WordPress website by using the public IP address of the ECS instance on which the WordPress website is hosted?

Possible causes and solutions:

  • Port 80 is not open in the security groups of the ECS instance, the system firewall is enabled on the ECS instance, or port 80 is used by a different service.

    For information about how to troubleshoot the issue based on the preceding causes, see What do I do if I cannot access a service deployed on an instance?

  • The PHP or MySQL version is incompatible with the WordPress version.

    Each WordPress version requires specific PHP and MySQL versions. If the PHP or MySQL version is incompatible with the WordPress version, WordPress may fail to be installed. For information about PHP and MySQL versions that are compatible with each WordPress version, see WordPress Compatibility.

References