Building a Shared Web Hosting Business 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.

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

Step 2: WHMCS Server Setup

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

scp -i path-to-ssh-key.pem path-to-whmccs.zip root@instance-ip:/root
ssh -i path-to-ssh-key.pem root@ecs-instance-ip
ls /root
apt update
apt full-upgrade -y
apt auoremove -y
apt install unzip sendmail software-properties-common wget -y
apt install apache2 -y
systemctl enable apache2
apt install php-fpm -y
apt install php-curl php-gd php-json php-mbstring php-imap php-iconv php-dev php-mysql -y
cd /root
Wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -xf ioncube*
cp ioncube/ioncube_loader_lin_7.2.so /use/lib/php/20170718/
nano /etc/php/7.2/apache2/conf.d/10-custom.ini
zend_extension="/usr/lib/php/20170718/ioncube_loader_lin_7.2.so"
max_execution_time = 60
max_input_time =60
memory_limit = 512M
max_input_vars = 6000
upload_max_filesize = 512M
post_max_size = 512M
systemctl restart php7.2-fpm
systemctl restart apache2
rm -rf /var/www/htm/index.html
vim /etc/apache2/sites-available/000-default.conf
ServerName your-primary-domain.tld
systemctl restart apache2
cd /root
unzip whmcs_v771_full.zip
mv whmcs/* /var/www/html
cd /var/www/html
mv configuration.php.new configuration.php
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

apt-add-repository ppa:certbot/certbot
apt update
apt install python-certbot-apache -y
certbot --apache -d portal.your-primary-domaindomain.tld
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

crontab -e
*/5 * * * * /usr/bin/php -q /var/www/html/crons/cron.php
rm -rf /var/www/html/install

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
wget -qO ee rt.cx/ee4 && bash ee
ee site create YOUR-PRIMARY-DOMAIN.TLD \
--cache \
--type=wp \
--admin-user=YOUR-WORDPRESS-USERNAME \
--admin-pass=YOUR-WORDPRESS_PASSWORD \
--admin-email=YOUR WORDPRESS EMAIL \
--dbname=YOUR DB NAME \
--dbuser=YOUR DB USERNAME \
--dbhost=YOUR RDS INSTANCE HOSTNAME \
--ssl=le

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
yum update
echo "server.your-primary-domain.tld" > /etc/hostname
hostname -F /etc/hostname
iptables.save > ~/firewall.rules
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
cd /home
curl -o latest -L https://securedownloads.cpanel.net/latest
sh latest
Whmlogin

Step 6: Integrating WordPress and WHMCS

Login to WordPress

Step 7: Integrating WHM and WHMCS

Login to WHMCS

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

Step 8: Integrating PayPal with WHMCS

We will use PayPal to receive payments from our customers.

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

--

--

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
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com