Cloud Computing 7 min read

Step-by-Step Guide to Deploy WordPress on a Tencent Cloud Server

This step‑by‑step guide shows how to provision a Tencent Cloud VM, install Nginx, PHP‑FPM and MySQL client, download and configure WordPress, set up its database, enable horizontal scaling with a load balancer, share the VM image, and finally clean up the database.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
Step-by-Step Guide to Deploy WordPress on a Tencent Cloud Server

Author: Liu Yongfeng, Tencent Cloud Evangelist.

Task 1: Create a Cloud VM and Log In

Log in to the public account, find your cloud VM in the console, and copy its public IP.

Download and install a client tool (PuTTY) to connect to the Linux server.

# Download PuTTY.exe from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Open PuTTY, enter the IP address in the Hostname field, click Open , and log in with the user Ubuntu and your password.

After a successful login, run # sudo su to switch to the root user.

Task 2: Purchase a Database Instance and Initialize It

Install MySQL client on the server: # apt-get install mysql-client Verify database connectivity.

Check the database’s internal and external IPs and connect:

# mysql -h10.66.126.19 -uroot -p

Task 3: Install and Configure Required Software

Update apt sources: # apt-get update Install Nginx: # apt-get install nginx Restart Nginx to verify installation: # service nginx restart Install PHP‑FPM: # apt-get install php5-fpm Install PHP MySQL extension: # apt-get install php5-mysql After installation, access the external IP in a browser to confirm Nginx is serving pages.

Task 4: Obtain WordPress Source Code and Configure It

Download WordPress:

# wget http://download-10012769.cos.myqcloud.com/wordpress-4.5.3-zh_CN.tar.gz

Create the web service directory: # mkdir /var/www Extract the archive to the directory: # tar -xzf wordpress-4.5.3-zh_CN.tar.gz -C /var/www Set directory ownership: # chown -R www-data:www-data /var/www/wordpress Configure Nginx using a script:

wget -O echo.sh http://yepscript.com/qcloud-wordpress
bash echo.sh

During the script execution, input the cloud server’s IP when prompted for the domain, then reload Nginx:

# service nginx reload

Task 5: Create the WordPress Database

In the Tencent Cloud console, create a MySQL database, set the root password, and add a user whose host is the VM’s internal IP.

Task 6: Restart Services

# service nginx restart
# service php5-fpm restart

Task 7: Install and Configure WordPress

Open the server’s IP in a browser, follow the WordPress installation wizard, and provide the database information created earlier.

Task 8: Use Load Balancing for Horizontal Scaling

Create a load balancer.

Bind the previously created cloud VM to the load balancer.

Create an image of the VM.

Launch a new VM from the image and attach it to the load balancer.

Stop one VM to verify that WordPress remains functional.

Task 9: Share the VM Image

Stop the cloud VM.

Create an image from the VM.

Set the image to be shared.

In the original account, view the shared image.

Task 10: Clean Up the Database

Connect to MySQL and drop the WordPress database:

# mysql -hIP -uUSERNAME -p
# drop database DATABASE_NAME;
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

load balancingLinuxmysqlNginxcloud deploymentWordPress
Tencent Cloud Developer
Written by

Tencent Cloud Developer

Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.