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 sarathy.info as my primary domain and sarathy.site 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

Prerequisites

  • 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
  • An ApsaraDB for RDS instance running the latest version of MySQL with two databases and two user accounts
  • Two domain names

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

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

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

Image for post
Image for post

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

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

Update the system

Upgrade the system

Remove unnecessary packages

Install the required components

Install Apache web server

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

Image for post
Image for post

Start Apache during boot

Install PHP

Install the PHP extensions required by WHMCS

Install Ioncube loader

Create a custom PHP configuration file

Paste the following lines

Restart PHP and Apache web server

Remove the default web page

Modify Apache’s configuration file

Add the following line

Restart Apache web server

Unzip the WHMCS installation package

Move the installation files to web server’s root directory

Create a new WHMCS configuration file

Change ownership of the web server’s root directory

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

Update the packages

Install certbot for Apache web server

Issue an SSL certificate

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

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

Image for post
Image for post

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

Image for post
Image for post

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

Add the following line

Delete the installation directory

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

Install EasyEngine

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

Image for post
Image for post

Let’s deploy our WordPress site

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

Image for post
Image for post

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

Update the system

Set the Fully Qualified Damion Name(FQDN)

Disable Firewall

Disable Network Manger

Download and install WHM

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

Image for post
Image for post

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

Image for post
Image for post

Click the Activate button to activate the plugin

Go to Settings >> WHMCS Bridge

Enter your WHMCS URL

Image for post
Image for post

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

Image for post
Image for post

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

Then, log in to WHM

Go to Development >> Manage API Tokens

Click Generate Token

Image for post
Image for post

Check the following permissions & click Save

Image for post
Image for post

Copy the generated API token

Go back to WHMCS. Fill the following details

  • Server Type: CPanel
  • Username: root
  • Password: YOUR WHM PASSWORD
  • API Token: Paste the token that you have copied from WHM

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

Image for post
Image for post

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

Image for post
Image for post

We have now successfully integrated PayPal with WHMCS!

Conclusion

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

Reference:https://www.alibabacloud.com/blog/building-a-shared-web-hosting-business-on-alibaba-cloud_594772?spm=a2c41.12860525.0.0

Written by

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store