How to Set Up a Scalable, E-Commerce-Ready WordPress Site Using ClusterCS

When a website, such as an online store, is at the core of your business, the site’s ability to serve customers through traffic spikes and sudden server failures can mean the difference between a big win and a frustrating loss. 

So, while setting up a single virtual server for the job is easier than ever, it’s worth taking a few moments to consider a high-availability cluster. In a cluster, instead of running everything on one machine, the different parts of the server architecture are handled by separate server instances. In such a setup, you can scale the server by adding more workers when the load grows and keep the server running even if one or more of the workers break for any reason.

When you are well prepared, you can stay assured that this year’s Black Friday sales or a sudden feature won’t bring your online store down.

In this tutorial, you will learn how to use ClusterCS and Amazon Web Services to create a scalable cluster of servers and to use it to host a WordPress site for a WooCommerce-based e-commerce website.

1. Set Up Your ClusterCS Account

ClusterCS is a control panel for servers in the cloud. It brings the power of regular control panels to your virtual and dedicated servers, collecting them all behind a single interface. The tool was originally created for handling the hosting accounts managed by Soft Dreams, the company behind it, so it has been well tested in real-life production environments.

ClusterCS supports multi-server applications such as the e-commerce-optimized WordPress site we’ll build in this tutorial, as well as maintaining individual servers.

To get started, visit the ClusterCS website and create an account.

ClusterCS home page

A free account lets you manage a single server and up to five separate domains running on it. A cluster setup split on multiple servers requires a paid account, but many of the steps you’ll see in the tutorial are applicable also on a single-server setup.

2. Start Some Virtual Servers

As a cloud-based control panel, ClusterCS works with any virtual or dedicated server: you can use it to control servers on Digital Ocean, Amazon Web Services (AWS), or even on a virtual machine running on your laptop.

In this tutorial, we’ll go with AWS. If you don’t have an AWS account yet, sign up for one. Then, sign in to the AWS Console to create the server instances for our website setup.

The setup we’ll create in this tutorial is as follows:

  • Load balancer (lb): This instance will be the outward-facing part of the cluster. It’ll also hold the files for your website.
  • Two (or more) application servers (app1, app2): These instances will run the web server. Having more than one application server makes the setup more resilient—if one goes down, the others can still serve the application’s pages. Also, adding more application servers is a quick way to respond to an increase in traffic.
  • Database server (db): Having the database separate from the app servers adds a level of security while making the database available for all servers using it.

Let’s get the servers up and running!

Step 1: Create a Security Group

When you launch servers for a cluster, it’s important to make sure they can talk to each other and that ClusterCS can reach them using SSH. 

At Amazon Web Services, firewall configuration is done using a Security Group. We’ll create one right at the beginning, but if you have connection troubles at any time, you can always return to verify and modify the settings. 

In the AWS EC2 Admin console’s left side menu, click on Security Groups. Then click on Create Security Group

In the popup that opens, give your security group a name and description. Then, click on Add Rule to add new rules one by one.

First, allow SSH access from the ClusterCS IP addresses and Then, allow HTTP and HTTPS access (ports 80 and 443) from everywhere so that your customers can access your website.

At this point, your security group setup will look like this:

Create Security Group

Click Create to save the changes.

Now that you have created the security group, it has an ID, which you can use to configure the access between your cluster’s server instances.

In the list of security groups, select the one you just created and open its Inbound tab. You’ll see the rules you just created. Copy the security group’s ID (a string starting with sg-) and click on the Edit button to modify the rules.

Add a new rule with the security group’s ID as the traffic source. You can either choose to allow all TCP traffic from this source or, if you prefer being more specific, use the following list of ports: 80, 443, 25, 110, 143, 465, 587, 993995, 2049, 111, 892, 662, 32803, 212049, 111, 892, 662, 32769, 80808081, and 8082.

At this point, your configuration will look like this:

Edit inbound rules

To be able to connect to the AWS instances from your computer, add an SSH rule for your IP. The AWS console has an option for this (“My IP”), so you don’t need to look up your IP.

Add a rule for your IP address

Finally, to allow FTP access for uploading files to the server cluster, add ports 21 and  5050050900.

Once that’s done, you are ready to start some servers.

Step 2: Start Four AWS EC2 Server Instances

With your security group in place, it’s time to launch the AWS instances for the cluster. AWS gives you many options for customizing the virtual servers, but most of the time, the default options are a good choice.

Return to the EC2 Dashboard and click the Launch Instance button.

Launch instances

Clicking the button starts a seven-step wizard for launching the server. 

In Step 1, you get to select the base image for your virtual server. Pick the first option, Amazon Linux AMI, by clicking the Select button next to it.

In Step 2, choose an instance type that fits the needs of your website; a smaller instance won’t be able to handle as much traffic as a larger one, but a larger one will be more expensive. Consider the roles the machines will play in your cluster. For example, you can quickly add new application servers in response to an increase in server load, but adding database resources is much more difficult. That’s why it’s a good idea to run the database on a more powerful server with more memory than on the app servers.

In steps 3 to 5 of the Launch Wizard, go through the options to see if there’s anything you’d like to modify—but most likely, the default options will be good for your setup.

In Step 6, choose the option Select an existing security group, and choose the security group we defined above. 

Finally, review your settings and click Launch to start the instances.

Review your EC2 instance configuration

As the last step, AWS will ask you to specify and download an SSH key pair for accessing the servers.

Key pair configuration

Select the Create a new key pair option and enter a descriptive name for the key pair. Then click Download Key Pair to download the private key file. 

Save the key in a safe place on your computer. I like to place all my SSH keys in the  ~/.ssh directory, but you can choose any location.

Once you have downloaded the key, the Launch Instances button becomes clickable. Click on it, and wait a few minutes for the instances to start.

If you are starting instances one by one, repeat the process for the next instances until all four servers for the cluster are up and running.

The server instances are now up and running

Step 3: Attach Elastic IP Addresses to Your Instances

AWS assigns IP addresses to your instances when you start them. Stopping an instance releases its IP address. As ClusterCS relies on the server’s IP addresses to connect to them, this can lead to trouble if for any reason you need to restart your instances.

To get past this issue, you can use AWS’s Elastic IP Addresses feature. 

An Elastic IP address is a permanent IP address that you can attach to any of your server instances. By using that address in your ClusterCS configuration, you can keep it pointing to the instance even if the instance is stopped.

Click on Elastic IPs in the AWS Console’s left side menu. Then, click on the Allocate new address button.

Allocate new address

Select VPC as Scope, and click Allocate. An IP address is immediately allocated for you to use.

Associate Elastic IP address

Right click on the IP address, and select Associate Address to link the IP to an EC2 server instance. 

Associate address

Click on the Instance text field. Then, select an instance from a dropdown menu showing all your instances. Finally, click Associate. Repeat the process for the rest of your EC2 instances.

Now, your servers can be accessed using their Elastic IP address, even after they have been restarted.

Step 4: Verify That You Can Access the Servers

Once your EC2 instances are up and running, before moving to ClusterCS, it’s good to verify that you can connect to them.

First, change the SSH key’s permissions:

Next, look up the instance’s public IP address (IPv4 Public IP) from the EC2 Dashboard:

Find the instances Public IP address

Then, connect to it, for example using the command-line client (or PuTTY if you are using Windows):

If you have trouble connecting, return to the Security Group settings and make sure all of the required ports are accessible. 

When you see that you can connect to the server, you are ready to move over to ClusterCS to set up the software for the servers on your cluster.

3. Set Up the Server Cluster

The server instances are now up and running. It’s time to configure them to do their part in running your e-commerce website as parts of a multi-server cluster. We will do this using the ClusterCS control panel.

The ClusterCS admin is split into two parts: Servers and Domains.

Select Manage Servers

The Servers section defines the underlying system: the server configuration and the software running on the one or more machines that form it. The Domains part, which we’ll look into in a bit, specifies customer accounts and sites that run on top of the low-level configuration.

Step 1: Add Server Instances to the Cluster

Click on Manage Servers to start configuring the cluster. If you use the free version, you won’t be able to create a cluster, but the steps in setting up a single server are very similar to what we’ll do in this part of the tutorial.

Click on Add cluster

Click on Add Cluster

Then, on the next page, scroll down to the Add new server section. There, you’ll see some instructions, followed by a form.

Add a new server to the cluster

To add the first server to the cluster, fill the form with the following information: 

  • Server IP: The server’s public IP address. You can find it from the EC2 Dashboard.
  • SSH Port: 22
  • User: ec2-user
  • Login type: SSH key
  • Host Name: A name that makes it easy for you to keep track of what the machine does. The field is only used as an identifier, so you can use any name you like, for example, lb for the load balancer and app1 for the first application server, and so on.

When you choose “SSH key” as the login type, a text area for entering the SSH key appears. Copy the contents of the .pem file you downloaded from AWS when starting the machines and paste it in this text area. Leave the SSH Key Password field empty.

Once all the data is in place, click Next.

ClusterCS will now connect to the server and verify that it matches the setup’s requirements. Once the check finishes, you’ll see the following results.

The server is OK for setup

Click on Add Server to Cluster Pool.

You’ll see that the server was added to the list of servers that are going to make up your cluster. 

Cluster server pool

Scroll down and repeat the process for the remaining three servers. 

Only then, click on Continue to Setup to configure the cluster and the services you wish to run on its different servers.

Step 2: Configure the Cluster

Now that all the servers are available for ClusterCS to use, you can start the fun part of choosing the roles for each of the servers. 

Cluster Setup

Give your setup a name and choose a recipe, a template configuration, to use as a basis for the configuration.

ClusterCS comes with an optimized starting point for PHP-based applications, called  Smart web server (optimized LAMP). On a single machine setup where the entire configuration runs on a single server, this recipe is ready to be used out of the box.

In a cluster setup, you will need to do a little more configuration.

Click Customize to open a detailed view. You will see the following list of “layers”, combinations of software modules that together give the servers their capabilities. All of the functionality within a layer can be configured, and you can also create new layers and add new applications to existing ones.

The layers forming your cluster configuration

Start from the first layer, Firewall, by clicking on the Manage link next to its title. You’ll see the following view for specifying the details of this layer. 

Configuring the Firewall layer

On the left side, you can choose which modules make up the layer (we’ll use the default set of modules, so you can leave that part as is). 

On the right side, you can select the servers that will run this layer. A firewall is something every server in the cluster needs to have, so select all four servers by clicking their names.

Then click Save to return to the cluster configuration view. Now, the Firewall layer looks like this:

Firewall configured to all servers in the cluster

Go through the rest of the layers in your cluster and create the following configuration:

Layer Servers
Firewall lb, db, app1, app2
Smart Traffic Manager lb
Webserver app1, app2
Database db
Email Not used, remove from configuration
Webmail Not used, remove from configuration
Storage lb, app1, app2
Utilities app1, app2

In this tutorial, there’s no need for email, so I removed the email-related layers from the configuration. If you want to use email in your setup, I suggest adding a separate server instance for it. That way, issues with your web server won’t interfere with your email or vice versa.

I activated the Storage layer on the load balancer machine as well as on the app servers. Later, when configuring the site, we’ll select the lb server as the one that holds its files. The two other machines will be mounted to it using NFS, so they too will have access to the data. This way, your website won’t be dependent on any single app server, and you can scale them up and down freely.

When everything looks good, click Save to save your configuration and start the installation process on the servers. 

Executing the cluster installation

The setup will take about 20 minutes to complete, depending on the size of your cluster.

4. Configure the Domain

You have now created a server cluster with a database server, two application servers, and a load balancer carefully routing traffic to the different instances. It’s time to start using the cluster by setting up a website to run on top of it.

Click on Domains in the ClusterCS top menu.

There are no domains yet

Then, click on Add Domain.

Add Domain

On this screen, you specify how the cluster (or a single server) is used for your domain. 

  • Domain Name: The domain name of your website. You can either configure the domain’s DNS settings outside of ClusterCS (point the domain to your load balancer instance’s public IP address) or check the Enable DNS Management option at the bottom of the screen and use ClusterCS’s name servers.
  • Username / Password: The username and password combination you (or your customer) will use to access the site using FTP.
  • Login Type: The method you want to use (or let your customers use) for accessing the server. You will still be able to connect to the underlying AWS instances using the SSH key method, but that’s probably not something you want your customers or other site admins to do.
  • Server: The server or server cluster the domain will run on. Pick the cluster you just created.
  • Storage Location: The server on which the site’s files will be stored. Pick the load balancer server (e.g. lb WooCommerce Cluster) as explained earlier.
  • Entry Point: The server instance in the cluster through which traffic comes to your website. This should point to the load balancer instance which can direct the traffic to the correct servers within the cluster.
  • IP: The public IP of the load balancer

When the setup looks good, click Add.

The domain is being added

Once the orange “In progress” text changes to “Active,” the domain is ready to be used. This step usually only takes a few minutes.

Optional: Configure SSL

On any website that handles sensitive customer information, such as people’s orders in an online store, it’s recommended to use SSL to encrypt the traffic between the user and the server.

Using ClusterCS, SSL is easy to set up. In the Domains dashboard, click on SSL. You’ll see three different ways for configuring SSL.

SSL Options

We’ll go with Let’s Encrypt, a free, widely trusted certificate authority backed by big organizations such as Mozilla and created to speed up the web’s move to secure browsing.

Click on Install Let’s Encrypt to start the setup.

Generate Lets Encrypt Certificate

Give the certificate a name, enter your email address, and select the domain names you want to create certificates for. Check the Auto renew checkbox so you will always have a valid SSL certificate.

Then click the Start button, accept the confirmation popup that shows up, and wait for the certificate generation to complete.

When the certificate is ready, you’ll see a screen with its information. 

The Lets Encrypt certificate is ready

The Let’s Encrypt SSL certificate is now ready to use. 

Configure the server cluster’s firewall to allow access to the load balancer from port 443, and your website is ready to accept HTTPS traffic.

On the Servers dashboard, next to your cluster, click Firewall. Then scroll down to the bottom of the page to add a new rule. 

Add New Firewall Rule

Set up the new firewall rule using the following information:

  • Server: lb (your load balancer instance)
  • Protocol: any
  • State: ANY
  • Source IP: any
  • (Source) Port Spectrum: All
  • Destination IP: any
  • (Destination) Port Spectrum: Exact
  • Port: 443
  • Action: Allow
  • Active: Checked

Click on the Add button to add the configuration and then on the Apply button to execute the changes in your server cluster.

5. Set Up WordPress

You are now ready to set up WordPress. The beauty of this ClusterCS setup is that, even though you are using multiple servers, the installation isn’t different from what you’d do with a single server or shared hosting.

Step 1: Create a Database for Your E-Commerce Site

Start by creating the database. In the Domains dashboard, select Databases. Then, click on Add Database.

On the next page, enter a name for your database (for example, wordpress), and click Create.

Create a database

On the next page, you’ll notice that the database has now been added.


Click on the Add New User button to create a new user. 

When the setup asks you to choose the host the database user can connect the database from, select Anyhost. This will allow the application servers to connect to the database, even though they are running on separate servers.

When you have added the user, click on Associate next to the user’s name to give the user access to that database.

Associate Database User

On the next page, you will be able to choose the permissions for the user in this database. Click on Check All to give the user full access to the database. Then, click on Associate User to apply these changes.

Select permissions for the database user

The database is now ready to be used. 

Step 2: Install WordPress 

Download the latest WordPress version and use FTP (using the username and password you specified when creating the domain) to upload it to your new site. If you have already configured your DNS settings, connect to your domain’s URL. You can also use the load balancer instance’s public IP address.

Upload WordPress using FTP

When you have uploaded WordPress to your site’s public_html directory, open the website’s URL in your browser and run the WordPress installation.

WordPress Database Setup

Use the following database information:

  • Database Name: The name of the database you just created.
  • Username: The name of the database user you just created.
  • Password: The password you selected for the database user.
  • Database Host: The private IP of your db server instances. You will find this information on the AWS EC2 Dashboard. Private IP addresses are used for server-to-server communication within the Amazon virtual private cloud.

When your WordPress installation is ready, continue by setting up WooCommerce and any other plugins and themes you want to use on your e-commerce site. 

Then, come back for some final optimizations, and to learn how to scale your cluster up and down.

6. Use ClusterCS to Optimize Your WordPress Setup

You have now configured a multi-server WordPress website on ClusterCS. The site is secure, stable, well organized, and easily scalable. But what exactly do you do when your online store or other website gets a lot of traffic and it’s time to scale the service up?

Step 1: Add App Servers

This is where you’ll see the power of a cluster setup: thanks to the work we did up front, when you need more processing power, you can simply add more servers to the cluster.

First, launch a new server instance on AWS, making sure it uses the same SSH key pair and belongs to the same security group as the other servers in the cluster.

Then, in the ClusterCS Manage Servers dashboard, click Manage to update your cluster’s preferences.

Scroll all the way down, and click on Add Servers.

Add Servers

Repeat the steps for adding a server to the cluster pool from above. 

Adding a new machine to the cluster

Click Continue to setup and configure the layers for the server. Select all the same software as on the app1 and app2 servers. Then click Save to apply the changes and wait until the configuration finishes. 

Your website is now running on three application servers instead of two. 

Step 2: Caching

As easy as adding new servers to the cluster is, it’s not the only thing you can do to respond to growing server requirements. In the Speed section of the ClusterCS Domains dashboard, you can configure rules for how requests coming to your website should be handled.

The ClusterCS Speed Tab

As you used the “Smart web server” recipe to start the cluster, you already have some optimizations in place: while PHP traffic is handled by Apache, there is a rule, “Static files to Lighttpd”, that tells the load balancer to route requests for static files such as images to Lighttpd to take some load off Apache.

Below that rule, you’ll notice a section for configuring your own configuration sets. 

There are many things you can do with this tool, but we’ll look at one of the most effective ones: caching a single page using Nginx. 

Fill in the following information:

  • Set name: Give your configuration a descriptive name, for example “Cache Shop Front Page”.
  • Operator: Select if all of the conditions need to be matched for the rule to apply (and) or if it’s enough if just one does (or).
  • Conditions: Add as many conditions as you need for specifying the rule. You can create your conditions based on path, cookies, IP, method, referrer, user agent, or dynamic values. In this case, choose path and ends_with, and type the shop page’s path—for example, /shop. Then click Add.
  • Action: Choose the action to do for requests matching these conditions. To cache the shop page, choose cache_with as the action and Smart Traffic Manager / Nginx as its parameter.

Click Add Set. Then, click Execute to apply the changes to your server cluster.

Now, the page will be cached using Nginx, which means that less time is spent on running PHP requests on the Apache server.


In this tutorial, you learned how to use ClusterCS to set up a cluster of AWS servers and a WordPress site on top of it. We also looked at ways of scaling the site up and down as well as configuring caching to handle big traffic spikes.

As you saw, these steps can also be applied to smaller, one-server setups, or alternatively, if you want to dig deeper into the details of your setup, ClusterCS has more options for that too.

Visit the ClusterCS website and Knowledge Base to learn more. The ClusterCS staff is also always ready to answer your questions and help you with your server setup.

Powered by WPeMatico

Leave a Comment

Scroll to Top