How to Deploy a WordPress Site on Alibaba Cloud SAS

This article was created in partnership with Alibaba Cloud. Thank you for supporting the partners who make SitePoint possible.

When it comes to cloud hosting, Alibaba Cloud is a relatively new kid in town. We have gotten used to AWS and its plethora of options, Heroku, and Google’s cloud solutions, which all either come with a level of complexity, or a price that is relatively high for anything except demo applications, or both.

Complexity in this area has lead to courses being taught and books being written about some of these solutions, like Amazon’s cloud.

--ADVERTISEMENT--

Developers know that all the time devoted to debugging, learning, and perfecting deployment is time not spent on developing the core solutions we are working to deploy.

When it comes to raw VPS solutions, DigitalOcean, Vultr, and Linode have been go-to vendors for some years now. Here, as well, there are tradeoffs: when one wants to deploy a high-level solution, like well-known Content Management Systems (such as Drupal or WordPress), or eCommerce solutions (such as Magento, WooCommerce, or OpenCart), they can choose a dedicated, specialized, high-profile managed hosting. These have pretty steep prices, and not much in terms of 100% dedicated resources. Alternatively one can go for a dedicated system. For one to have a guaranteed 4GB of RAM available for their web application, or guaranteed processor cores, an available system shell, or one wants to be able to switch server stack components versions, one has to go for a dedicated server or a VPS.

Shared hosting environments only go so far in terms of squeezing the last bits of performance out of your server, or choosing and optimizing components of the server stack. They don’t give you ultimate control of the hosting environment, and often deliver mediocre results.

The dedicated systems that we mentioned are often the best solution for high-performing systems, and projects that care about a tuned and polished web visitor experience. They tend to be relatively affordable, they guarantee server resources, if not the entire machine in data center, but… they put a demand on the developer, or sysadmin, to set things up. If these dedicated systems come with sysadmin time and care included, they are usually not very competitive on price.

Non-managed VPS and dedicated server solutions have the best edge here, in terms of hosting costs. This is where companies like Digital Ocean, Vultr and similar hosts have blossomed. But these vendors require knowledge of Linux administration, and knowledge of the intricacies of server stacks, like LAMP, LEMP, and others.

With dedicated solutions, one has to hire sysadmins and developers to set these things up. They need to install the latest version of PHP and all of its modules, then the database and the server (like Apache or Nginx), and then there is the setup of the virtual host, SSL, debugging and compatibility issues that arise, package issues, the list goes on…

This makes dedicated hosting a non-trivial endeavor. This is where companies like Cloudways have found their niche.

Alibaba Cloud

And now there is Alibaba Cloud.

Alibaba Cloud is an ambitious vendor which offers a comprehensive spectrum of services, from CDN, cloud-based database services, big data and analytics solutions, media streaming and IoT solutions, and shared web hosting or flexible VPS solutions.

They boast their own proprietary virtualization solutions developed in-house, without the virtualization overhead, and with good resource isolation. A major known solution without the virtualization overhead so far has been OVZ, but it hasn’t provided such good resource isolation. This is why its competitor technologies, KVM and XEN, have fared somewhat better with the premium range of VPS providers.

If Alibaba has indeed developed a solution with little-to-no resource overhead, but with excellent isolation, this will give them an edge on the VPS providers market.

One of Alibaba products is SAS – Simple Application Server. Since SAS builds on ECS architecture, it takes advantage of the aforementioned virtualization solutions.

Simple Application Server use the ECS I/O-optimized shared instances with CPUs, memory, operating systems, network, disks, and other services necessary to build a server.

Each user can have up to five SAS instances running.

Its goal is to find the sweet spot in servicing exactly the customers we described above – those who need price-competitive hosting solutions which offer control of the environment and a guarantee of resources.

Simplicity of Deployment

What the SAS solution boasts is the ability for everyone to launch their web application within minutes – from Alibaba’s web management platform, without the need to set everything up – or even to log into the system’s shell.

This is not something that established VPS vendors can boast about, for the most part.

We have tried this, and it took us a mere couple of minutes from logging into our Alibaba account to actually seeing our website live and running.

The process is painless and straightforward.

When we register for Alibaba Cloud here, we are presented with its free credit offer – Alibaba gives $300 of credit to new users. We can use it for the purpose of this tutorial – deploying a WordPress website on Simple Application Server. After we confirm our payment method, such as a credit card or PayPal, we get our starting credit activated, and we are good to go!

Now we can log into our management console, and select Simple Application Server in the left sidebar, among the Base services. When we are there, we can click “Create Server” button in the upper right corner, and we will be presented with options for selecting the server location – EU, US and Asia locations are available.

We can then select one of the prebuilt available images — apps or OS images are available (different Linux and Windows versions). For this guide, we selected the WordPress app image.

We then select the instance plan. These plans have different hardware resources available and payment plans, including monthly, quarterly, six monthly payment plan, annually and so on.

Plans available range from 0.5 to 8 GB of RAM, 1 or 2 CPU cores, and all come with SSD storage, from 20 to 80GB. Those in need of more flexibility have other solutions available that are somewhat lower-level, but offer more control, like ECS.

After we pay, we can go to the management console for our SAS instance, which will take a couple of minutes to be deployed.

After our instance is deployed, it has an entire LAMP stack installed, along with WordPress. We then go to the web management panel, which is among the best — perhaps in its level of details and options it even has an edge over the competitors, like Vultr, Digital Ocean, and others.

There are plenty of options here, and even not-so technically apt users should have an easy time finding their way around.

We can monitor the utilization of our server resources in detail here.

In the application dashboard, we find all the details of our WordPress installation, directions to retrieve our login details, database details, and we can connect to our instance via web-based shell (SSH).

We can also add our public keys to our account, so we can use real SSH tools to connect to our instance and have full control – we can install other server stack components, like the newest PHP version, an alternative server like NGINX, Litespeed, or Caddy, or a caching solution like Varnish. If we go with stock Apache, we may choose to login via SSH and switch our Apache server to use the more efficient event mpm, which should help us to utilize our server resources better.

We can choose to install a proprietary SSL certificate, or add more virtual hosts to our server if we want to host more than one website.

To summarize, we have a 5-minute WordPress installation with full flexibility on the custom server instance afterwards.

After we have installed our instance, we have our IP address, and when we visit it inside our browser, we will be presented with the generic WordPress installation.

Currently, the website is available through the IP address we were assigned, because we still haven’t attached any web URL to the domain. If we purchase our domain through Alibaba (Alibaba is in the domain business, too, and they have some nice deals at the time of writing), and we use Alibaba Cloud DNS, we can assign our domain directly through our SAS web management panel.

In this case, we will also be able to manage our SSL certificates from our instance’s web panel.

If this isn’t the case, we will need to point our DNS records in our domain management panel of some other provider, to the IP address that Alibaba Cloud assigned to our SAS instance.

Image above: Namecheap’s DNS management console

Now, our instance isn’t set up 100% the same as a generic, off-the-shelf Linux instance meaning that, if we want to have more websites, or change our settings, we won’t find, for example, our server setup in /etc/httpd directory as one would expect. Instead, our web management panel informs us that our relevant environment variables are in the /root/env.txt file.

This is also where we will find passwords for our WordPress installation, and our MySQL database. We should login after the initial installation, and complete our WordPress user profile. At this time, provided that we previously directed our domain to our server instance, we also need to add our domain to WordPress settings under Settings > General, and add a Site Title.

If we don’t set up the two URL settings the WordPress installation won’t work like it should, although our homepage may load without issues. After we do this, sometimes it can be necessary to save/update permalinks.

The file /root/env.txt will tell us that our relevant Apache configuration files are in /usr/local/apache. This is where we will be able to set up our virtual hosts, and change the Apache setup.

Alibaba SAS also allows us to set firewall rules to close access to any TCP ports. Each SAS instance can have up to 50 firewall rules. By default, only ports 22 (ssh), 443 (https) and 80 (http) are open, and others are closed. In the SAS web console, we can find the firewall under Security > Firewall. Rules open the ports, and we can add rules from the list of presets for applications that use certain ports, like telnet, FTP, SSH, MySQL and others.

For backing up our instances, Alibaba Simple Application Server provides free snapshots – each server can have up to three snapshots, which can be easily restored. This is a server-level backup solution, but we recommend that important, or critical WordPress projects also have an application-level, regular backup solution such as the Updraft plugin.

These snapshots give us a way to back up the entire instance. It can take up to half hour to create a snapshot of our server, which is then available for rollback – which will overwrite the entire server.

Once we have created the snapshot of our server instance, we may also choose to upgrade it, to get more server resources. This is also a seamless process, which we can initiate by clicking the Upgrade link beside the snapshot in our instance’s management web console.

Since SAS is really a higher level layer built on top of the more barebones ECS (Elastic Compute Service), we can take advantage of this, and gain more control of our server by getting to know intricacies of Elastic Compute Service (ECS).

Conclusion

In this article we have given an overview of the Simple Application Server package by Alibaba Cloud – the latest major player and contender in the market of cloud services. Although some details may need polishing, we can say that the market will improve by what Alibaba has to offer – both in terms of pricing and in terms of technology.

We have also gone through the deployment of a WordPress website – but we have stuck with the bare bones installation. In reality, this is an endeavor which is usually a lot more involved, depending on the actual use-case and website.

Advantages of Alibaba Simple Application Server are simplicity and ease of deployment. It takes less then 5 minutes to get full VPS server with WordPress website online – without advanced knowledge.

One of Alibaba Cloud’s best features is a unified admin interface that allows us to monitor system resources, create and restore snapshots, access the server through the shell, and more all through the web. This means that painless WP-CLI management of the whole system is, upon installation, available through the web interface – meaning easy updates, plugin installations and management, post bootstrapping, object cache flushing, and much more.

Take advantage of Alibaba Cloud’s $300 free credit for new users and take the service for a spin yourself!