WordPress is a free, open-source content management system (CMS). You can use it to quickly create and manage various types of websites, including blogs, news sites, e-commerce stores, and social networks. With a vast library of themes and plugins, WordPress makes it easy to customize your site's appearance and functionality. This tutorial shows several methods to quickly set up a WordPress site.
Setup options
This document provides three methods to set up a WordPress site. Choose the one that best fits your needs.
|
Method |
Example operating systems |
Description |
|
One-click deployment with ROS |
|
Use Resource Orchestration Service (ROS) to automate the deployment of a WordPress site. For more information, see What is Resource Orchestration Service? |
|
Quick setup with a Marketplace image |
Alibaba Cloud Linux 3.2104 Note
If you have specific operating system requirements, you can select a Marketplace image with the corresponding operating system. |
Alibaba Cloud Marketplace provides WordPress images to quickly set up a WordPress site without deploying a web environment. This method is ideal for users new to building websites with ECS. For more information, see Marketplace. |
|
One-click deployment with Terraform |
|
You can use Terraform to automate the deployment of a WordPress site. For more information, see Terraform on Alibaba Cloud. |
Procedure
Deploy with ROS (recommended)
-
Click One-click deployment, configure the parameters as prompted, and then click Deploy Now.
Key parameters:
-
Region: Select the region where you want to create the ECS instance.
-
Instance source:
If you have specific requirements for billing, disks, or networking, we recommend that you purchase an ECS instance in advance and then select an existing instance for deployment. For more information, see Create an instance by using the custom launch method.
Create a new instance
ROS automatically creates a preemptible instance and deploys WordPress on it. Because preemptible instances do not support ICP filing, create a subscription instance for at least three months if you need this filing. Then, select the existing instance for automatic WordPress deployment.
-
Instance image: Select one of the following images:
-
Ubuntu 20.04/22.04
-
CentOS 7.7/7.8/7.9
-
Alibaba Cloud Linux 3.2104 LTS 64-bit (Recommended)
-
-
Instance Type: Select an instance type based on your needs. For more information, see Instance families.
-
Instance password: Enter and confirm the password for the ECS instance.
Select an existing instance
ROS automatically deploys WordPress on the selected instance. The ECS instance must have public internet access and run one of the following operating systems:
NoteIf you did not assign a public IP address when you purchased the instance, associate an Elastic IP Address (EIP) with it. For more information, see Associate an EIP.
-
Ubuntu 20.04/22.04
-
CentOS 7.7/7.8/7.9
-
Alibaba Cloud Linux 3.2104
-
-
-
ROS automatically deploys the resources. The deployment is complete when the progress reaches 100%.
NoteAfter deploying WordPress, you can perform the following operations:
-
View created resources: In the ROS console, you can view information about the created resources, such as the ECS instance, VPC, and security group. For more information, see View a stack.
-
Change the MySQL database password: Run the command
sudo grep 'temporary password' /var/log/mysqld.logto view and then change the initial password for the root user. For more information, see FAQ.
-
-
Click View Deployed Site. You are redirected to the WordPress configuration page.
-
Fill in the required information, and then click Install WordPress.
Parameters:
-
Site title: The name of your WordPress site. For example, demowp.
-
User Name: The username for logging in to WordPress. Choose a secure username. For example, testwp.
-
Password: The password for logging in to WordPress. Use a strong password. For example, Wp.123456.
-
Your email: The email address for receiving notifications. For example, username@example.com.
-
-
Click Log In. Enter the username
testwpand passwordWp.123456that you set during the installation, and then click Log In.You are now logged in to your WordPress site. For more information about using WordPress, see the official WordPress documentation.
After you log in, the WordPress admin Dashboard is displayed. The navigation pane on the left includes menus such as Posts, Media, Pages, Comments, and Appearance, which you can use to start managing your site content.
Use a Marketplace image
The WordPress Platform (ALinux3 LNMP PHP) image used in this example has the following environment:
-
Operating system version: Alibaba Cloud Linux 3.2104
-
Nginx version: 1.26.2
-
PHP version: 8.2
-
MySQL version: 8.0.40
-
Create an ECS instance from a WordPress image.
Note-
If you already have an ECS instance and it does not contain important data, you can change the system image. In the Marketplace Image tab of the Image section, select the WordPress Platform (ALinux3 LNMP PHP) image. For more information, see Change the operating system.
-
If you did not assign a public IP address when you purchased the instance, associate an EIP with it. For more information, see Associate an EIP.
Go to ECS console - custom launch.
-
On the Custom Launch page, configure settings such as the billing method, region, availability zone, and instance type.
-
In the Images section, click the .
-
Enter
WordPressin the search box, click Search, select an image, and then click Use.You can click an image title in the search results to go to the image's product page in Marketplace and view its configuration details. The WordPress Platform (ALinux3 LNMP PHP) image used in this example is shown below.
Note-
If you have specific operating system requirements, you can select a Marketplace image that meets them.
-
When you choose a Marketplace image, pay attention to its cost. If the image displays
¥0/hr, the image itself is free of charge.
The WordPress Platform (ALinux3 LNMP PHP) image used in this example includes Alibaba Cloud Linux 3 + Nginx + MySQL + PHP + WordPress. In the search results, click Use to select the image.
To explore more environments, you can search and filter in Marketplace.
-
-
Configure the remaining parameters as prompted.
Pay attention to the following parameters. For more information about other parameters, see Create an instance by using the custom launch method.
-
Images: The Images section is automatically set to the image you selected.
-
Public IP Address: Select Assign Public IPv4 Address and set a bandwidth value based on your business needs.
-
-
-
Obtain the credentials for WordPress and the MySQL database.
-
Connect to an ECS instance.
For more information, see Log on to a Linux instance using Workbench.
-
Run the following command to view the database credentials.
sudo cat /root/ReadMe############################################################## # For more information please visit https://weiliu.cn # ############################################################## Wordpress admin password: xxx MySQL root password: xxx FTP account: xxx FTP password: xxx Online documentation https://weiliu.cn/docs/wordpress/
-
-
Add an inbound rule to the security group to allow traffic on port
80. For more information, see Add a security group rule.You can also allow traffic on other ports as needed. For example:
-
To connect to the MySQL database remotely, you must allow traffic on the default MySQL port, 3306.
-
To use HTTPS, you must allow traffic on port 443.
-
-
Log in to WordPress.
-
In a web browser, enter
http://<Instance-Public-IP>/wp-admin.The WordPress login page appears.
-
Log in to the site with the WordPress credentials you obtained.
If the following page appears, you have successfully set up your WordPress site. For more information about using WordPress, see the following resources:
After you log in, the WordPress Dashboard is displayed. The navigation pane on the left includes menus such as Posts, Media, Pages, Comments, and Appearance, which you can use to start managing your site.
-
Deploy with Terraform
-
Click One-click deployment to go to Terraform Explorer, where the following Terraform code is automatically loaded.
-
Modify the parameters based on your needs. By default, a VPC and a pay-as-you-go ECS instance with an Ubuntu operating system are created in the China (Beijing) region. For more information about ECS billing, see Billing overview.
-
Click Start Debugging to preview the resources to be created. If the resource details are correct, click Preview and Execute to start creating the resources. The deployment is complete when the execution status shows Succeeded.
-
Verify the deployment.
-
In a web browser, enter the following address. Replace <instance_public_ip> with the IP address from the Terraform output.
http://<instance_public_ip> -
Fill in the basic website information, and then click Install WordPress.
Parameters:
-
Site title: The name of your WordPress site. For example, wordpress.
-
User Name: The username for logging in to WordPress. Choose a secure username. For example, wordpressuser.
-
Password: The password for logging in to WordPress. Use a strong password. For example, Test@12345.
-
Your email: The email address for receiving notifications. For example, username@example.com.
-
-
Click Log In.
-
Enter the username
wordpressuserand passwordTest@12345that you set during the installation, and then click Log In.You are now logged in to your WordPress site. For more information about using WordPress, see the official WordPress documentation.
-
Related operations
Domain resolution and HTTPS
Accessing a site by its IP address is insecure and unprofessional. We recommend that you associate a domain name with your site and enable HTTPS encryption.
-
Register a domain name and complete ICP filing
-
If you do not have a domain name, you can register one with Alibaba Cloud.
-
If a domain name points to a website that is hosted on an Alibaba Cloud server in the Chinese mainland, an ICP filing is required. For your first ICP filing, see ICP Filing Process. For all other cases, see ICP Filing Process.
-
-
Resolve your domain name to the public IP address of your ECS instance.
-
Replace the instance's public IP address with the new domain name.
-
Connect to the instance remotely and log in to the MySQL database.
mysql -u root -p -
Switch to the WordPress database and set the domain name.
Replace
public_ipwith the instance's public IP address anddomainwith your domain name.use wordpress; UPDATE wp_options SET option_value = replace(option_value, 'http://PUBLIC_IP', 'http://DOMAIN') where option_name = 'home' OR option_name = 'siteurl'; EXIT;
-
-
Configure an SSL certificate (HTTPS)
Deploy an SSL certificate to enable encrypted data transmission with HTTPS. This protects user privacy and improves browser trust and SEO rankings.
FAQ
Cannot access WordPress with the public IP
-
Check the security group: Make sure the instance's security group allows inbound traffic on port 80.
-
Check the firewall: Make sure the operating system's internal firewall (such as firewalld) is not blocking port 80.
-
Check service status: On the ECS instance, run
sudo systemctl status nginxandsudo systemctl status php-fpmto ensure the services are in theactive (running)state. -
Check port listening: Verify that port 80 is being listened on.
For detailed troubleshooting steps, see Troubleshoot access failures to services in an ECS instance.
Cannot access pages with permalinks
Using static-like page URLs can improve your site's search engine optimization. Before setting permalinks in WordPress, you must configure rewrite rules in Nginx.
-
Connect to the instance remotely and open the Nginx configuration file.
sudo vim /etc/nginx/conf.d/default.confPress the
ikey to enter edit mode and add the following code inside thelocation /block.try_files $uri $uri/ /index.php?$args;Press the
Esckey, enter:wq, and then press theEnterkey to save and exit the file. -
Restart the Nginx service for the changes to take effect.
sudo systemctl restart nginx
Troubleshoot update and upload errors
This issue is often caused by incorrect file permissions for the WordPress configuration, themes, or plugins. Follow these steps to resolve it.
-
Log in to the ECS instance and open the WordPress configuration file.
sudo vim /usr/share/nginx/html/wordpress/wp-config.phpPress the
ikey to enter edit mode and add the following code at the end of the file.define("FS_METHOD","direct"); define("FS_CHMOD_DIR", 0777); define("FS_CHMOD_FILE", 0777);Press the
Esckey, enter:wq, and then press theEnterkey to save and exit the file. -
Return to the WordPress Dashboard and refresh the page. The issue with FTP credentials should now be resolved.
If the "cannot create directory" error persists, change the ownership of the website's root directory to the Nginx user,
nginx.sudo chown -R nginx /usr/share/nginx/html/wordpress -
If the issue persists after the steps above, PHP-FPM may be running as a different user than Nginx. Run the following command to check the current PHP-FPM user:
grep -E '^user|^group' /etc/php-fpm.d/www.confIf the output shows
user = apacheandgroup = apache, change them tonginxand restart the PHP-FPM service:sudo sed -i 's/^user = apache/user = nginx/; s/^group = apache/group = nginx/' /etc/php-fpm.d/www.conf sudo systemctl restart php-fpm
Change default MySQL credentials
-
Connect to the ECS instance remotely and log in to the MySQL database.
mysql -u root -p -
Switch to the
mysqldatabase and view the usernames.use mysql; select user from mysql.user; -
Change the database username and password.
-
Change the database username to a new username.
UPDATE user SET user='NEW_USER_NAME' WHERE user='USER_NAME';For example, to change the username from
roottoadmin:UPDATE mysql.user SET user='admin' WHERE user='root'; -
Change the password for the database user.
ALTER USER 'USER_NAME'@'localhost' IDENTIFIED BY 'PASSWORD';For example, to change the password for the
rootuser toPassword@2025!:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password@2025!';
-
-
Flush the privileges to apply the changes and exit the MySQL database.
FLUSH PRIVILEGES; EXIT;
Related documents
-
To manually set up a WordPress site, see the following topics:
-
To set up a WordPress site in Docker, see Deploy an application by using Docker Compose.
-
To set up a WordPress site (based on ECS and RDS) by using Compute Nest, see WordPress.
-
If you have associated a domain name with your WordPress site, you can configure HTTPS encrypted access for it. For more information, see Deploy an SSL certificate.