Building a Shared Web Hosting Business on Alibaba Cloud

By Partha Sarathy, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Are you ready to start your own web hosting business? If your answer is yes, then you will find this tutorial useful! In this article, we will be teaching you how to set up your own shared web hosting service for your businesses on Alibaba Cloud.

Architecture Diagram

We need three Elastic Compute Service (ECS) instances, one ApsaraDB for RDS MySQL instance, and two domain names for this project. I will be using the domain as my primary domain and as my secondary domain.

The two ECS instances shown on the left-hand side of the following architecture diagram will host our main website. One ECS instance is used for deploying WHMCS and the other one for deploying WordPress. Both WordPress and WHMCS require MySQL. So we will also deploy an ApsaraDB for RDS instance.

ECS instance shown on the right-hand side of the below diagram will be used to host our customers’ sites. We will automate everything using a very popular software called WHM (Web Hosting Manager).

Architecture Diagram


  • Two ECS instances running on Ubuntu 18.04 and one ECS instance running on CentOS 7 with at least 20 GB disk space & 1 GB of RAM

Step 1: Configure DNS

DNS configuration for our primary domain

Record TypeHostValueA@ECS Instance’s IP (running WordPress)AwwwECS Instance’s IP (running WordPress)AportalECS Instance’s IP (running WHMCS)

DNS configuration for our secondary domain

Record TypeHostValueNSns1ECS Instance’s IP (running WHM)NSns2ECS Instance’s IP (running WHM)

Step 2: WHMCS Server Setup

First of all, you need to download WHMCS from their official website

Next, we have to copy the downloaded file to our server via SCP( Secure Copy) protocol

scp -i path-to-ssh-key.pem root@instance-ip:/root

Now the WHMCS installation file will be copied to the root user’s home directory ( /root) of our server.

Let’s log in to our ECS instance for installing WHMCS

ssh -i path-to-ssh-key.pem root@ecs-instance-ip

You will be logged into the ECS instance as shown as follows

Verify whether we have successfully transferred the WHMCS installation file to into our ECS instance or not.

ls /root

If you get the following output, you are ready to go!

Update the system

apt update

Upgrade the system

apt full-upgrade -y

Remove unnecessary packages

apt auoremove -y

Install the required components

apt install unzip sendmail software-properties-common wget -y

Install Apache web server

apt install apache2 -y

Verify Apache server’s installation by accessing the ECS instance’s IP address in your web browser

Start Apache during boot

systemctl enable apache2

Install PHP

apt install php-fpm -y

Install the PHP extensions required by WHMCS

apt install php-curl php-gd php-json php-mbstring php-imap php-iconv php-dev php-mysql -y

Install Ioncube loader

cd /root
tar -xf ioncube*
cp ioncube/ /use/lib/php/20170718/

Create a custom PHP configuration file

nano /etc/php/7.2/apache2/conf.d/10-custom.ini

Paste the following lines

max_execution_time = 60
max_input_time =60
memory_limit = 512M
max_input_vars = 6000
upload_max_filesize = 512M
post_max_size = 512M

Restart PHP and Apache web server

systemctl restart php7.2-fpm
systemctl restart apache2

Remove the default web page

rm -rf /var/www/htm/index.html

Modify Apache’s configuration file

vim /etc/apache2/sites-available/000-default.conf

Add the following line

ServerName your-primary-domain.tld

Restart Apache web server

systemctl restart apache2

Unzip the WHMCS installation package

cd /root

Move the installation files to web server’s root directory

mv whmcs/* /var/www/html

Create a new WHMCS configuration file

cd /var/www/html
mv configuration.php

Change ownership of the web server’s root directory

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

Step 3: Deploying HTTPS for WHMCS

HTTPS protocol provides a secured encrypted connection between our servers and clients. We will install an SSL certificate from Let’s Encrypt Certificate Authority. We will use a program called certbot for automating the process of issuing SSL certificates

Add certbot PPA

apt-add-repository ppa:certbot/certbot

Update the packages

apt update

Install certbot for Apache web server

apt install python-certbot-apache -y

Issue an SSL certificate

certbot --apache -d portal.your-primary-domaindomain.tld

Enter your email and agree to the terms and conditions by entering A.

Once the certificate is issued, certbot will show you two options. Choose Redirect all requests to secure HTTPS access

Once you select the above option, HTTPS will be deployed successfully.

Certificates provided by Let’s Encrypt CA are valid for only 90 days.

So you have to log in to your server every 3 months and enter the following command to renew the certificate

certbot renew

Step 4: Installing WHMCS

So far, we have completed all the necessary steps to install WHMCS. Now its time to start the installation process

Go to https://portal.your-rimarydomain.tld/install/install.php from your web browser

After reading the Terms & Conditions, click Agree

WHMCS will check for all the basic requirements. If the requirements are satisfied, you can proceed with the installation. Otherwise, WHMCS will let you know the missing requirement

Click Begin Installation

You will be asked to enter your Licence key and Database details. You can get your licence key from your WHMCS dashboard. For database details, enter your RDS instance details. After entering the details, click Continue

The installation is almost is complete. We have to just add a cronjob and delete the installation folder

Login into the ECS instance & run the following commands

crontab -e

Add the following line

*/5 * * * * /usr/bin/php -q /var/www/html/crons/cron.php

Delete the installation directory

rm -rf /var/www/html/install

Go to https://portal.your-primary-domain.tld/admin to log in to WHMCS

Step 5: Installing WordPress

Login to the another ECS instance which is running on Ubuntu 18.04 via SSH

ssh -i path-to-public-key.pem root@ecs-instance-ip

Install EasyEngine

wget -qO ee && bash ee

When the installation is completed, you will get the summary of the installation similar to the following image

Let’s deploy our WordPress site

ee site create YOUR-PRIMARY-DOMAIN.TLD \
--cache \
--type=wp \
--admin-email=YOUR WORDPRESS EMAIL \
--dbname=YOUR DB NAME \

Once the site is deployed, you will get the summary of the deployed website similar to the following image

Now go to https://your-primary-domain.tld/wp-admin

Step 6: Installing WHM

Login to the ECS which is running on CentOS 7 via SSH

ssh -i path-to-public-key.pem root@ecs-instance-ip

Update the system

yum update

Set the Fully Qualified Damion Name(FQDN)

echo "server.your-primary-domain.tld" > /etc/hostname
hostname -F /etc/hostname

Disable Firewall > ~/firewall.rules
systemctl stop firewalld.service
systemctl disable firewalld.service

Disable Network Manger

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

Download and install WHM

cd /home
curl -o latest -L
sh latest

The installation will take up to 45 minutes to complete. Once the installation is over, get the WHM login URL using the following command.


Go to the displayed login URL & complete the installation

Step 6: Integrating WordPress and WHMCS

Login to WordPress

Go to Plugins >> Add New

Search for WHMCS Bridge

Click Install Now once you find it

Click the Activate button to activate the plugin

Go to Settings >> WHMCS Bridge

Enter your WHMCS URL

Click Check My Installation

If the integration is successful, a success message will be shown as follows

That’s it!

Step 7: Integrating WHM and WHMCS

Login to WHMCS

Go to Setup >> Products/Services >> Servers

Click Add New Server

Enter the Server name, IP address, network hostname, etc

Then, log in to WHM

Go to Development >> Manage API Tokens

Click Generate Token

Check the following permissions & click Save

Copy the generated API token

Go back to WHMCS. Fill the following details

  • Server Type: CPanel

Click Save Changes

Now we have successfully integrated WHMCS and WHM

Step 8: Integrating PayPal with WHMCS

We will use PayPal to receive payments from our customers.

Go to PayPal.Com & SignUp for a Business account. If you already have a PayPal personal account,you have the option to upgrade it to a Business account as shown below

Once you have done creating a business account, go to Tools >> Business Setup >> Payment Setup >> On Your Website

Click the Continue button under Process all payments including credit and debit cards through PayPal

Click Get Your API credentials

Choose Request API Signature & click Agree and Submit

Copy the API Username, API Password, API Signature

Login to WHMCS

Go to Setup >> Payments >> Payment Gateways >> PayPal Express Checkout

Paste the copied API Username, API Password & API Signature.

Then click Save Changes

We have now successfully integrated PayPal with WHMCS!


We have successfully installed and configured WHMCS, WHM & WordPress for our web hosting company. Now it is time to create your own hosting packages and start selling. If you have any questions, feel free to ask in the comment section


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.