Cloud Service Cloud Service Contact Us

Huawei Cloud Agency Onboarding Huawei Cloud ECS WordPress website tutorial

Huawei Cloud / 2026-05-15 13:42:02

Introduction: WordPress on Huawei Cloud ECS, aka “Make the Internet Pay Rent”

So you want to host a WordPress website on Huawei Cloud ECS. Congratulations: you’ve chosen one of the most popular ways to publish your content and also one of the most common ways to accidentally learn new things about Linux at 2 a.m. But don’t worry. This guide is designed to be clear, structured, and friendly—like a lab partner who actually read the manual.

We’ll go step-by-step: create an ECS instance, set up the server environment, install the web stack, install WordPress, configure networking and security, connect your domain, enable HTTPS, and verify everything works. We’ll also cover common issues and what to do when WordPress stares back at you with a blank page. Spoiler: it’s usually something fixable, like missing database credentials or file permissions behaving like they’re in a bad mood.

What You’ll Build (And What You Won’t)

By the end of this tutorial, you’ll have a working WordPress site running on Huawei Cloud ECS. Specifically, you’ll have:

  • An ECS instance ready to host a web application
  • Nginx (or Apache, if you prefer) serving your site
  • PHP installed and configured to run WordPress
  • a MySQL/MariaDB-compatible database for WordPress
  • WordPress installed and configured with basic site settings
  • Firewall and access rules set so the site is reachable
  • Domain mapping using DNS records (A/AAAA as appropriate)
  • HTTPS enabled with a certificate (for peace of mind and browser sanity)

What we won’t do (because you asked for a tutorial, not a novel): We won’t build a fully enterprise-grade deployment with high availability, auto-scaling, CDN edge caching, or Kubernetes. Those are great, but they’re like adding a rocket engine to a bicycle. Helpful if you’re going to the moon; unnecessary for a normal blog.

Prerequisites: Before You Touch Anything (Seriously)

Before we start clicking buttons like a caffeinated squirrel, gather these basics:

  • A Huawei Cloud account
  • Access to the Huawei Cloud console
  • A domain name you control (optional now, but helpful for later)
  • Basic comfort with SSH and the command line (no need to be a wizard, just don’t faint)

Also, decide where you want your WordPress files to live. Typically, they go under a web root directory like /var/www/html on Linux. We’ll follow common patterns so you can troubleshoot without wondering if the server is haunted.

Step 1: Plan Your ECS Setup (Sizing Without Regret)

Let’s choose an ECS instance size. WordPress itself isn’t huge, but PHP, caching, and plugins can grow your appetite. Here are sensible starting points:

  • For a small personal site: 1 vCPU, 1–2 GB RAM
  • For a small business blog: 2 vCPU, 2–4 GB RAM
  • For heavier traffic or lots of plugins: 2–4 vCPU, 4–8 GB RAM

If you expect traffic spikes or you’re launching something big, you may want to implement caching (server-side and/or via a CDN). But for the tutorial’s purpose, start simple.

Step 2: Create an ECS Instance on Huawei Cloud

Now let’s get your server. The exact buttons can vary slightly depending on UI updates, but the concepts stay the same.

  1. In Huawei Cloud, go to Elastic Cloud Server (ECS).
  2. Click Create Server.
  3. Choose a region (pick the one closest to your visitors if possible).
  4. Select the OS. A common choice is Ubuntu 20.04/22.04 or CentOS/RHEL-based distribution.
  5. Pick the instance type and size based on the planning section.
  6. Configure networking:
    • Make sure you can assign a public IP (or set up a load balancer later).
    • Choose a security group (firewall rules) that allows HTTP/HTTPS as needed.
  7. Set storage:
    • At least 20 GB is a comfortable baseline for WordPress plus media and updates.
  8. Create the instance and note down:
    • The public IP or hostname
    • The SSH login method (password or key)

Once created, wait for it to become active. Yes, it will take a few minutes. No, it won’t rush because you’re impatient. That’s okay. WordPress isn’t going anywhere.

Step 3: Connect to Your ECS via SSH

Open a terminal and SSH into the instance. If you use a key file, your command will look like this:

ssh -i /path/to/your-key.pem ubuntu@YOUR_ECS_PUBLIC_IP

If you use password login, the command might be similar but without -i, and then you’ll be prompted for a password.

When you log in for the first time, you should:

  • Update packages
  • Check you have basic tools installed

On Ubuntu/Debian, you can do:

sudo apt update
sudo apt upgrade -y

After that, we’ll move on to the “stack”: web server, PHP, and the database.

Step 4: Install the Web Stack (Nginx, PHP, Database)

There are different ways to install a WordPress-ready environment. The most common modern approach is:

  • Nginx as the web server
  • PHP (with required extensions)
  • MariaDB/MySQL as the database

We’ll use Nginx and a common MariaDB setup. If you prefer Apache, you can adapt, but this guide keeps things consistent and easier to troubleshoot.

Step 4A: Install Nginx

On Ubuntu/Debian:

sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx

Test that the default page loads. On your local computer, go to http://YOUR_ECS_PUBLIC_IP. If you see the Nginx default page, congratulations: your server is alive.

Step 4B: Install PHP and Extensions

WordPress requires PHP, usually a supported version. Many distributions ship with PHP versions, but you might need an updated repository depending on OS age.

For a typical Ubuntu setup (and assuming PHP 8.x is available), install PHP-FPM and required extensions:

sudo apt install -y php-fpm php-mysql php-xml php-mbstring php-curl php-gd php-zip php-intl

Enable and start PHP-FPM:

sudo systemctl enable php*-fpm
sudo systemctl start php*-fpm

Then verify PHP works:

php -v

If PHP returns a version number, you’re good. If not, check installation logs or whether PHP packages installed correctly.

Step 4C: Install MariaDB (Database Server)

Now we need a database. WordPress uses a MySQL-compatible database.

Install MariaDB:

sudo apt install -y mariadb-server
sudo systemctl enable mariadb
sudo systemctl start mariadb

Secure the installation (recommended):

sudo mysql_secure_installation

Follow prompts. Set a root password, remove anonymous users, disallow root login remotely, and remove test databases when asked.

Step 5: Create the WordPress Database and User

WordPress needs a database and a user account with privileges. Let’s create them.

Log into MariaDB:

sudo mariadb

Run something like this (replace names/passwords with your own):

CREATE DATABASE wordpress_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'YOUR_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Be careful with spelling. Databases are like cats: they will ignore you if you get the details slightly wrong, and then act like it’s your fault.

Step 6: Configure Nginx for WordPress

We need Nginx to serve WordPress. WordPress requires routing that allows pretty permalinks and correct handling of PHP requests.

First, decide your document root. Standard Nginx uses /var/www/html. We’ll use that directory as the WordPress target (for simplicity in a tutorial).

Step 6A: Create a Server Block

On Ubuntu, Nginx site configurations are often in /etc/nginx/sites-available/ and enabled via symlinks in /etc/nginx/sites-enabled/.

Create a file such as /etc/nginx/sites-available/wordpress:

sudo nano /etc/nginx/sites-available/wordpress

Paste a configuration similar to this (adjust server_name and root if needed):

server {
    listen 80;
    listen [::]:80;

    server_name YOUR_DOMAIN_OR_ECS_PUBLIC_IP;

    root /var/www/html;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php*-fpm.sock;
    }

    location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
        expires 30d;
        add_header Cache-Control "public";
        access_log off;
    }
}

Two important notes:

  • php*-fpm.sock depends on your PHP version; you may need to match the correct socket file name. If you’re unsure, check /var/run/php/ for phpX.Y-fpm.sock.
  • If you don’t have a domain yet, you can temporarily set server_name to the public IP.

Step 6B: Enable the Site and Test Nginx

Enable the site:

sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/

Test configuration:

sudo nginx -t

If it says everything is fine, reload Nginx:

sudo systemctl reload nginx

Your Nginx config is now ready for WordPress. It’s like setting a table before the guests arrive, except the guests are PHP scripts and database queries.

Step 7: Download and Install WordPress

Now let’s install WordPress files into /var/www/html. The recommended approach is to download the official WordPress package from the official source. We’ll use a generic approach:

  1. Huawei Cloud Agency Onboarding Go to the document root:
cd /var/www/html
  1. Download WordPress (example uses curl/wget). If you don’t have them, install the missing tool first.
# Example using wget
sudo apt install -y wget
sudo wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz
  1. Extract:
sudo tar -xzf /tmp/wordpress.tar.gz --strip-components=1
  1. Set correct ownership for the web server user.

On Ubuntu, Nginx usually runs as www-data:

sudo chown -R www-data:www-data /var/www/html

Now open your browser and go to:

http://YOUR_ECS_PUBLIC_IP (or http://YOUR_DOMAIN if DNS already points correctly)

You should see the WordPress setup page.

Step 7A: Complete the WordPress Installer

In the WordPress installation form, you’ll need:

  • Database name: wordpress_db
  • Username: wordpress_user
  • Password: YOUR_STRONG_PASSWORD
  • Database host: typically localhost
  • Table prefix: usually wp_ (or another prefix if you know why you’re doing it)

Huawei Cloud Agency Onboarding Then:

  • Set Site Title (something descriptive)
  • Create an Admin username and password
  • Choose your admin email

When WordPress completes, you’ll be able to log in to the admin dashboard.

Huawei Cloud Agency Onboarding Step 8: Configure Firewall and Security Group Rules

Here’s where many tutorials silently skip important details. Let’s not. Firewalls are the difference between “my site works” and “my site is trapped in a locked room.”

Huawei Cloud typically uses a security group attached to the ECS instance. You must allow inbound traffic for:

  • HTTP on port 80
  • HTTPS on port 443
  • SSH on port 22 (restrict this to your IP range if possible)

If you also installed UFW on the OS (some people do), then you must allow ports there too. But if you rely only on Huawei Cloud security groups, that’s fine.

Step 9: Enable Pretty Permalinks (The “.htaccess?” Moment)

WordPress permalinks can be configured to show post names. On Apache, WordPress often uses .htaccess. On Nginx, the configuration is handled in the server block and WordPress works with the try_files rule we added earlier.

Log into the WordPress admin dashboard:

  • Go to Settings → Permalinks
  • Huawei Cloud Agency Onboarding Select a structure like /%postname%/ or /%year%/%monthnum%/%postname%/
  • Save changes

If it errors, check that your Nginx configuration includes the try_files $uri $uri/ /index.php?$args; directive (we included it). That’s your “permalinks handshake.”

Step 10: Connect a Domain (DNS Mapping)

Huawei Cloud Agency Onboarding If you have a domain, you’ll want it to point to your ECS public IP.

In your domain registrar/DNS provider, set an A record:

  • Host: @ (or your subdomain like www)
  • Value: YOUR_ECS_PUBLIC_IP
  • TTL: default is fine

If you’re using IPv6 and have it, set AAAA too. If you don’t, stick to A records.

Wait for DNS propagation. It can be minutes or hours, depending on the provider and the laws of networking chaos.

When DNS is ready, update Nginx server_name to your domain and reload Nginx. Alternatively, you can keep server_name as _ or include both IP and domain, but it’s cleaner to match your final setup.

Step 11: Enable HTTPS with Let’s Encrypt (Because Browsers Demand Drama)

HTTPS isn’t just about looking cool. Browsers will increasingly treat HTTP sites like they’re wearing questionable cologne. Let’s Encrypt provides free certificates.

Install Certbot. On Ubuntu:

sudo apt install -y certbot python3-certbot-nginx

Huawei Cloud Agency Onboarding Request a certificate:

sudo certbot --nginx -d YOUR_DOMAIN -d WWW_YOUR_DOMAIN

Follow prompts to choose automatic redirect to HTTPS. Certbot will update Nginx configuration automatically.

Verify your site loads on:

  • https://YOUR_DOMAIN
  • https://www.YOUR_DOMAIN (if configured)

You’re now running a WordPress site with encryption. Your visitors’ browsers can finally relax.

Step 12: Hardening Basics (Turn the Boring Locks On)

You don’t need to become a full-time security engineer, but basic hardening prevents common problems.

Step 12A: Keep Everything Updated

sudo apt update && sudo apt upgrade -y

Also keep WordPress core, themes, and plugins updated. Outdated plugins are like leaving the front door open and decorating it with “I’m vulnerable!” signs.

Step 12B: Disable WordPress File Editing

In wp-config.php add:

define('DISALLOW_FILE_EDIT', true);

This prevents admins from editing theme/plugin files via the dashboard.

Step 12C: Use Strong Admin Passwords and 2FA

Choose a strong password and consider enabling two-factor authentication with a WordPress security plugin.

Step 12D: Set Proper File Permissions

In general:

  • Directories: 755
  • Files: 644
  • wp-config.php: more restricted (commonly 600)

Huawei Cloud Agency Onboarding Be cautious when changing permissions. If you set them incorrectly, WordPress may refuse to upload media or update plugins. And nothing is more exciting than a WordPress that can read but can’t write.

Troubleshooting: When Things Go Sideways (They Usually Do)

Let’s handle the classic “why is my site doing that?” moments. Here are common issues and how to fix them.

Problem 1: Nginx Shows 502 Bad Gateway

A 502 often means Nginx can’t reach PHP-FPM.

Check PHP-FPM status:

sudo systemctl status php*-fpm

Also verify your fastcgi_pass socket path in Nginx config matches the real socket file.

Then test Nginx:

sudo nginx -t
sudo systemctl reload nginx

Problem 2: WordPress Installer Can’t Connect to Database

Huawei Cloud Agency Onboarding This usually means incorrect database name, username, password, host, or permissions.

Double-check values you entered. Also confirm MariaDB user grants:

SELECT user, host FROM mysql.user;

Make sure the user exists for 'wordpress_user'@'localhost' (or adjust if WordPress is connecting from another host).

Also check MariaDB logs:

sudo journalctl -u mariadb --no-pager

Problem 3: WordPress Site Loads but Permalinks Fail

Return to Settings → Permalinks and save again after verifying Nginx config contains the try_files directive.

Also check Nginx error logs:

sudo tail -n 200 /var/log/nginx/error.log

If you see routing or rewrite-related errors, it’s usually the Nginx server block.

Problem 4: Uploads Fail (Media Library Doesn’t Work)

This is often permissions. WordPress needs write access to wp-content/uploads.

Ensure correct ownership:

sudo chown -R www-data:www-data /var/www/html/wp-content

Then try uploading again.

Problem 5: WordPress Installation Page Shows but Clicking Next Fails

This might be due to PHP memory limits or missing PHP extensions.

Check PHP errors in Nginx logs and PHP-FPM logs. Also verify extensions like php-xml, php-mbstring, php-curl, php-gd, and php-zip are installed.

Performance Tips (Because “It Loads Eventually” Isn’t a Strategy)

WordPress performance depends on caching and server resources. Here are practical improvements that don’t require rocket science:

  • Enable a caching plugin in WordPress (page cache) such as built-in solutions or popular caching plugins
  • Install OPcache for PHP (often enabled by default depending on PHP version)
  • Use a CDN if you have traffic far from your region
  • Choose a lightweight theme and keep plugin count under control

If your server has limited RAM, consider enabling swap or upgrading instance size. But try caching first; it’s usually the best bang for your buck.

Backup Strategy: Don’t Rely on Hope

Backups are essential. WordPress can be restored, but you don’t want to learn that after deleting your database.

A simple approach:

  • Back up the WordPress files directory (/var/www/html)
  • Back up the database (wordpress_db)
  • Store backups somewhere separate (object storage or another server)

On many systems, you can create scheduled backups using cron jobs and export tools. On Huawei Cloud, consider using related storage services for backup destinations.

WordPress Maintenance Checklist (The “Do This, Future You Will Thank You” List)

  • Update WordPress core and plugins regularly
  • Remove unused plugins and themes
  • Huawei Cloud Agency Onboarding Monitor disk space (logs and uploads can grow)
  • Check server CPU and memory usage
  • Review security logs and fail2ban or equivalent protections if you use them
  • Renew HTTPS certificates automatically (Certbot can handle this)

This list may not be glamorous, but it’s more effective than any “make the site better” button in a dashboard that you’ve never clicked because you were worried it would break something. (It probably won’t, but the fear remains.)

FAQ: Quick Answers to Common Questions

Do I need a separate database service?

No, for a tutorial and small deployments you can run MariaDB on the same ECS instance. For larger production setups, you might use managed databases. But for learning and getting started, self-hosted MariaDB on ECS is fine.

Can I use Apache instead of Nginx?

Yes. WordPress supports Apache well. The main differences are the web server configuration. This article focuses on Nginx because it’s widely used and pairs nicely with PHP-FPM.

What about caching and CDN?

For performance, caching is recommended. A CDN improves global latency. If you’re launching a site to the world, it’s worth considering. For a local or regional audience, start with server-side caching first.

Why is server_name important?

server_name tells Nginx which domain to serve based on the Host header. If it’s wrong, you might get unexpected pages or redirect behavior. Not always fatal, but it can cause confusing issues later.

Conclusion: You Did It. Your WordPress Has a Home.

You’ve successfully set up a WordPress website on Huawei Cloud ECS. That means you’ve achieved something both useful and mildly addictive: you can now publish content, install plugins, tweak themes, and brag (responsibly) that you host your own site. You also now have a deeper understanding of how Linux, Nginx, PHP, and databases cooperate under the hood like a team of coordinated squirrels.

If anything didn’t work on the first try, don’t panic. Check logs, confirm service status, and verify configuration paths—especially PHP-FPM socket paths and database credentials. Most WordPress deployment problems are configuration problems, not destiny problems.

Next steps you might consider:

  • Install a security plugin and configure basic hardening
  • Set up automated backups
  • Enable caching and optimize WordPress performance
  • Configure monitoring so you get alerts before the site becomes a “why is my traffic gone?” mystery

Welcome to the exciting world of running your own infrastructure. It’s like owning a small garden: rewarding, sometimes messy, and worth it when it starts growing.

TelegramContact Us
CS ID
@cloudcup
TelegramSupport
CS ID
@yanhuacloud