How to Setup WordPress with Nginx and HHVM on Ubuntu 16.04

By Hitesh Jethva, 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.

HHVM also known as HipHop Virtual Machine is an open source virtual machine developed by Facebook that can be used for executing programs written in Hack and PHP. HHVM uses a just-in-time compilation approach for performance reasons. HHVM is faster than the traditional PHP engine from ZEND, and is used by Facebook to serve billions of web requests per day.

In this tutorial, we will be going to explain how to install WordPress with Nginx, MariaDB, and HHVM on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 16.04 instance.

Prerequisites

  • A fresh Alibaba cloud instance with Ubuntu 16.04 server installed.
  • A static IP address 192.168.0.103 is configured on the instance.
  • A root password is setup on the server.

Launch an Alibaba Cloud ECS Instance

First, login to your Alibaba Cloud ECS Console. Create a new ECS instance, with Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install Nginx and MariaDB

First, you will need to install Nginx web server and MariaDB to your server. You can install them using the following command:

Once both are installed, start Nginx and MariaDB service and enable them to start on boot time using the following command:

Configure MariaDB

By default, MariaDB installation is not secured, so you will need to secure it first. You can secure it by running the mysql_secure_installation script:

Answer all the questions as shown below:

Once MariaDB is secured, log in to MariaDB shell using the following command:

Enter your root password when prompt, then create a database for WordPress:

Next, grant all privileges on wordpressdb using the following command:

Next, flush the privileges with the following command:

Finally, exit from the MariaDB shell with the following command:

Install and Configure HHVM

By default, HHVM is not available in Ubuntu 16.04 default repository. So you will need to add HHVM repository to your system. You can do this by running the following command:

Next, update the HHVM repository and install HHVM using the following command:

Once HHVM is installed, you should see the following output:

Next, you will need to configure Nginx web server to use HHVM. You can do this with the following command:

You should see the following output:

Next, start HHVM automatically on system startup using the following command:

Next, run the following command to use HHVM as a PHP alternative:

FInally, start HHVM service using the following command:

You can check the status of HHVM using the following command:

Output:

Now, verify the PHP version with the following command:

Output:

Install WordPress

First, you will need to download the latest version of the WordPress from their official website. You can do this with the following command:

Once the download is completed, unzip the downloaded file with the following command:

Next. copy the extracted directory to the Nginx web root directory using the following command:

Next, change the directory to the /var/www/html/ and copy wordpress sample config file:

Next, open wp-config.php file and add database credentials which you have created earlier:

Make the following changes:

Save and close the file, then give proper permissions to WordPress:

Finally, restart the Nginx and HHVM services.

Access WordPress Web Installation Wizard

Now, open your web browser and type the URL http://your-server-ip/index.php, you will be redirected to the following page:

Here, choose the English language and click on the Continue button, you should see the following page:

Here, provide your Sitename, admin username and email address, then click on the Install WordPress button. Once WordPress is installed, you should see the following page:

Now, click on the Log In button, you will be redirected to the WordPress login page:

Now, provide your login credential and click on the Log In button, you should see the WordPress dashboard in the following image:

Related Alibaba Cloud Products

ApsaraDB for RDS is an on-demand database service that frees you up from the administrative task of managing a database, and leaves you with more time to focus on your core business. ApsaraDB for RDS is a ready-to-use service that is offered on MySQL, SQL Server and PostgreSQL. RDS handles routine database tasks such as provisioning, patch up, backup, recovery, failure detection and repair.
Distributed Relational Database Service is a lightweight (stateless), flexible, stable, and efficient middleware product independently developed by Alibaba Group to resolve scalability issues with single-host relational databases.
DRDS is primarily used for large-scale online data operations to operate, maintain and manage distributed databases throughout their entire lifecycle. Due to is compartmentalized structure, DRDS provides an efficient way to perform operations to meet the demand of the online services for relational databases.
Alibaba Cloud Virtual Private Cloud Alibaba Cloud VPC allows the flexibility to build your cloud architecture in a logically isolated and secure environment. This means users can control their virtual networking environment, including the selection of IP address range, the creation of subnets and configuration of route tables and network gateways. Users can also segregate VPC instances into different security domains using security group features.

Reference:

https://www.alibabacloud.com/blog/how-to-setup-wordpress-with-nginx-and-hhvm-on-ubuntu-16-04_593759?spm=a2c41.11699137.0.0

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