This article was created in partnership with Alibaba Cloud. Thank you for supporting the partners who make SitePoint possible.
WordPress is one of the most popular content management systems (CMS) in the market, owing to the fact that it is completely free to use and extremely versatile. Typically, you would deploy WordPress on a LAMP stack, regardless of the type of website, as WordPress is based on MySQL and PHP.
In this article however, we will discover how to deploy a WordPress website on a LEMP stack. We have chosen NGINX as our web server instead of the more popular Apache because it is much faster, more scalable and secure for a single site.
By completing the steps in this article, you should expect a fresh WordPress site running on an Alibaba Cloud Elastic Compute Service (ECS) instance, running a highly performant LEMP Stack.
Step 1: Provision and Secure an Ubuntu 16.04 Server
In the first step, we will create an Alibaba Cloud ECS instance running Ubuntu 16.04. This step is pretty straightforward, it mostly involves purchasing an ECS instance from the Alibaba Cloud console, selecting your preferred configurations, and running some Linux commands.
However, to improve security, we will also be securing the server by creating a superuser and disabling root login. We will then configure the Ubuntu UFW (Uncomplicated FireWall) on the server.
This provides a versatile foundation upon which we will complete our LEMP stack, which we will do in the next step.
Step 2: Completing the LEMP Stack
In this step, we will complete a modern LEMP stack for our WordPress website. Specifically, we will be setting up our LEMP stack with a highly-performant combination of NGINX, MariaDB, and PHP7. This setup is widely regarded as the optimum foundation for a modern WordPress site.
At present, we can only visit our site by entering the server IP address in a web browser, so we will fix that in the next step by configuring a domain name to serve our site, and securing everything with an SSL certificate. After that, we will move on to installing WordPress on our LEMP stack.
Step 3: Configuring a Domain and Let's Encrypt SSL
In the third step, we will run through Domain Management for our site, adding DNS records, and installing a Let’s Encrypt SSL certificate. In the previous two steps, we provisioned and secured our Ubuntu 16.04 server installation, and then completed the LEMP stack with NGINX, MariaDB, and PHP7. However, we will need to configure a domain to make our server publicly accessible. Additionally, we will secure our WordPress site with an SSL certificate so it can only be accessed via HTTPS.
Your ECS instance should now have a secured and highly performant LEMP stack installed, with a domain configured, and a secure SSL certificate protecting visitors' information.
Step 4: Installing WordPress on Your Alibaba Cloud ECS Instance
In the fourth step, we will be installing WordPress via both by using
wget/curl and the WordPress Command Line (WP-CLI). This is where you have a decision to make, as this tutorial is going to show you two different ways to install WordPress.
curl and editing config files using
nano is the common way. It is a trusty and reliable method, and worth going through in case you need to fall back on this method in the future. The alternative to
curl is using WP-CLI, an awesome command line interface for WordPress. It's an incredible time saver, and, once you get used to it, you can use it to manage all your WordPress sites with an efficient workflow.
Step 5: Using DirectMail for WordPress Transactional Email
In the previous steps we secured an Alibaba Ubuntu 16.04 ECS instance, installed a LEMP stack, configured our DNS and nameservers, and installed WordPress. So do we have a fully functional WordPress site? Well, not so fast.
One of the things with cloud hosting, with any provider, is that while you get a fast server you don't have things like email functionality automatically configured and provided by the hosting provider. Right now, our WordPress site can't send transactional emails for it to be fully functional.
Alibaba Cloud’s DirectMail service is the perfect choice for this functionality. In this step, we will setup DirectMail as the SMTP provider for our WordPress application's transactional emails.
By following the steps above, we have successfully installed WordPress on a highly performant LEMP stack using an Alibaba Cloud ECS instance. Our WordPress application is also equipped with email functionality; we can subscribe new users, send email notifications, and change passwords by email.
To make sure Alibaba Cloud DirectMail is correctly set up as the SMTP provider for our WordPress site, you can just visit your inbox and check to make sure you received the email.
That’s it! We now have WordPress up and running and fully functional on an Alibaba Cloud stack. For more tutorials, visit the official Getting Started page on Alibaba Cloud.