WordPress is a popular open-source website builder. Deploy WordPress on ECS to quickly launch a site and start publishing content.
Procedure
Before you begin, make sure you have completed your account setup and linked a credit card or PayPal account.
New ECS users who have completed their account setup can try ECS free for 3 months. For details, see the ECS Free Trial.
Step 1: Create an ECS instance
Go to the ECS console - Instances page, click Create Instance.
Choose Custom Launch and configure the instance.
Configure the instance with the following example settings. Keep the defaults for any settings not listed here.
Configuration item
Example value
Billing Method
Pay-as-you-go
Region
US (Silicon Valley)
Network and Zone
VPC: Default VPC
vSwitch: Select the default vSwitch in Availability Zone B.
Instance
ecs.c9i.large
We recommend at least 2 vCPU and 4 GiB of memory for a smooth experience.
Image
Select Alibaba Cloud Linux 3.2104 LTS 64bit under Public Images.
System Disk
Type: Enterprise SSD (ESSD)
Size: 40 GiB
Performance: PL0
Public IP Address
Select Assign Public IPv4 Address.
Bandwidth Billing Method
Pay-by-traffic
We recommend selecting Upgrade to CDT for Data Transfer Billing. This provides 220 GB/month of free public traffic after upgrade: 20 GB/month for Chinese mainland regions, 200 GB/month for regions outside.
Security Group
Select New Security Group. Under the Basic Security Group settings, in the Open IPv4 ports/protocols section, select HTTP (TCP:80) and SSH (TCP:22) to allow external HTTP access.
Logon Credential
Select Set Later
Review the estimated cost, read and accept the terms of service, and click Create Order.
Step 2: Connect to the ECS instance
Return to the instance list. Wait until the instance status shows Running and Health Status shows Normal, then click Connect in the Actions column.
In the dialog box, click Sign in now.
Select Password-Free and click Log In.
A remote connection session stays active for up to 6 hours. If idle for more than 6 hours, the session disconnects automatically and you must reconnect.
A command-line prompt indicates a successful connection.
Step 3: Set up WordPress
Deploy the LNMP environment.
Run the following script to install the LNMP stack (Linux + Nginx + MySQL + PHP) required by WordPress. Replace
MYSQL_PASSWORDwith a custom MySQL root password before running. You will need this password when configuring the WordPress database.The password must be 8 to 30 characters and include uppercase letters, lowercase letters, digits, and special characters. Supported special characters:
()` ~!@#$%^&*-+=|{}[ ]:;'<>,.?/.curl -fsSL https://help-static-aliyun-doc.aliyuncs.com/install-script/deploy-lnmp-acl3_2.sh | MYSQL_ROOT_PASS='MYSQL_PASSWORD' bashThis script is designed for Alibaba Cloud Linux 3.2104 LTS 64bit only.
Log in to MySQL and create a database and user for WordPress.
MYSQL_PASSWORD: MySQL root password you set in the previous step.WORDPRESS_PASSWORD: A custom password for the WordPress database user.The password must be 8 to 30 characters and include uppercase letters, lowercase letters, digits, and special characters. Supported special characters:
()` ~!@#$%^&*-+=|{}[ ]:;'<>,.?/.
mysql -u root -p'MYSQL_PASSWORD' <<EOF CREATE DATABASE wordpress; CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'WORDPRESS_PASSWORD'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress_user'@'localhost'; FLUSH PRIVILEGES; EOFThis creates a database named
wordpressand a userwordpress_userwith full privileges on that database.Download and extract WordPress.
cd /usr/share/nginx/html && sudo wget https://cn.wordpress.org/wordpress-6.4.4-zh_CN.zip && sudo yum install unzip -y && sudo unzip wordpress-6.4.4-zh_CN.zipConfigure the database connection.
Back up the default configuration.
sudo cp /usr/share/nginx/html/wordpress/wp-config-sample.php /usr/share/nginx/html/wordpress/wp-config.phpEdit
wp-config.phpto set the database credentials. ReplaceWORDPRESS_PASSWORDwith the WordPress user password you set.sudo sed -i "s/database_name_here/wordpress/" /usr/share/nginx/html/wordpress/wp-config.php && \sudo sed -i "s/username_here/wordpress_user/" /usr/share/nginx/html/wordpress/wp-config.php && \sudo sed -i "s/password_here/WORDPRESS_PASSWORD/" /usr/share/nginx/html/wordpress/wp-config.php
Update the Nginx site root directory and restart the service.
sudo sed -i 's|root /usr/share/nginx/html;|root /usr/share/nginx/html/wordpress;|' /etc/nginx/conf.d/default.conf && sudo nginx -t && sudo systemctl restart nginx
Step 4: Install WordPress and publish your first article
Install and log in to WordPress.
Open a browser and go to
http://<ECS public IP address>to access the WordPress installation page.You can find the public IP in the IP Address column of the instance list.
Enter the site title, administrator username, password, and email, then click Install WordPress.
After installation, click Log In and enter the credentials you just set.
Publish an article to verify access.
In the left navigation pane, go to .
Enter a title (for example, "Hello from Alibaba Cloud ECS") and click Publish in the upper-right corner. Click Publish again in the confirmation dialog.
Copy and open the article URL. If the page displays your article, the website is live.
Billing
Billable items
System disk: 40 GiB (disk capacity) × disk unit price × billing duration
Public bandwidth (pay-by-traffic): Outbound traffic × per-GB price
After upgrade to CDT for Data Transfer Billing, you will receive 220 GB/month of public network traffic (20 GB/month for Chinese mainland regions, 200 GB/month for regions outside).
Compute resources: Instance type unit price × billing duration
Refer to the ECS Pricing page for unit prices.
View billing details
Log on to the Expenses and Costs Console, and then choose . Filter by Product Name and select Elastic Compute Service to view detailed charges.
Clean up resources
Release the instance when you no longer need it to stop incurring charges.
Releasing an instance permanently deletes all its data. This action cannot be undone.
In the instance list, click in the Actions column for the target instance.
Choose Release Now and click Next.
Confirm that no associated resources need to be retained, and click OK.
Related information
The default security group rules allow access from all IP addresses, which poses a security risk. We recommend that you modify the security group rules to allow only necessary IP addresses.
Accessing a site by IP address alone is not professional or secure. We recommend binding a domain name and enabling HTTPS.
If the current instance type cannot meet your workload requirements, you can change the instance type.