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.
Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.
apt-get update -y
First, you will need to install Nginx web server and MariaDB to your server. You can install them using the following command:
apt-get install nginx mariadb-server mariadb-client -y
systemctl start nginx
systemctl enable nginx
systemctl start mariadb
systemctl enable 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:
Enter current password for root (enter for none): PRESS ENTER
Set root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
Once MariaDB is secured, log in to MariaDB shell using the following command:
mysql -u root -p
MariaDB [(none)]> create database wordpressdb;
MariaDB [(none)]> grant all privileges on wordpressdb.* to wordpress@localhost identified by 'password';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
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:
apt-get install software-properties-common
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
Next, update the HHVM repository and install HHVM using the following command:
apt-get update -y
apt-get install hhvm -y
Once HHVM is installed, you should see the following output:
HHVM is installed.
The best way to get started is to use HHVM's built-in webserver:
$ hhvm -m server -p 8080
Running command-line scripts with HHVM requires no special setup:
$ hhvm whatever.php
FastCGI is also supported; see https://docs.hhvm.com/hhvm/advanced-usage/fastCGI
Next, you will need to configure Nginx web server to use HHVM. You can do this with the following command:
[ ok ] Starting hhvm (via systemctl): hhvm.service.
Checking if Apache is installed
WARNING: Couldn't find Apache2 configuration paths, not configuring
Checking if Nginx is installed
Detected Nginx installation
Checking for custom Nginx configuration
Enabling hhvm Nginx module
Finished enabling module
Next, start HHVM automatically on system startup using the following command:
update-rc.d hhvm defaults
/usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
systemctl start hhvm
systemctl status hhvm
hhvm.service - LSB: Starts The HHVM FastCGI Daemon Loaded: loaded (/etc/init.d/hhvm; bad; vendor preset: enabled) Active: active (running) since Wed 2018-05-16 21:13:19 IST; 1min 14s ago Docs: man:systemd-sysv-generator(8) CGroup: /system.slice/hhvm.service ├─3365 /usr/bin/hhvm --config /etc/hhvm/php.ini --config /etc/hhvm/server.ini --user www-data --mode daemon -vPidFile=/var/run/hhvm/ ├─3389 /usr/bin/hhvm --config /etc/hhvm/php.ini --config /etc/hhvm/server.ini --user www-data --mode daemon -vPidFile=/var/run/hhvm/ ├─3390 sh -c /usr/bin/hh_single_compile -v Hack.Compiler.SourceMapping=1 --daemon └─3392 /usr/bin/hh_single_compile -v Hack.Compiler.SourceMapping=1 --daemon May 16 21:13:18 Node1 systemd: Starting LSB: Starts The HHVM FastCGI Daemon... May 16 21:13:19 Node1 systemd: Started LSB: Starts The HHVM FastCGI Daemon. May 16 21:14:29 Node1 systemd: Started LSB: Starts The HHVM FastCGI Daemon.
Now, verify the PHP version with the following command:
HipHop VM 3.26.2 (rel)
Repo schema: 7960f749dc8fba766d4ac967f6693b0ff0f1430b
First, you will need to download the latest version of the WordPress from their official website. You can do this with the following command:
cp -r wordpress/* /var/www/html/
cp wp-config-sample.php wp-config.php
Next, open wp-config.php file and add database credentials which you have created earlier:
/* The name of the database for WordPress /
/* MySQL database username /
/* MySQL database password /
/* MySQL hostname /
chown -R www-data:www-data /var/www/html/
chmod -R 775 /var/www/html/
systemctl restart nginx
systemctl restart hhvm
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:
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.
Alibaba Clouder - July 20, 2018
Alibaba Clouder - December 5, 2017
Alibaba Clouder - August 9, 2018
Alibaba Clouder - June 29, 2018
- November 14, 2017
Alibaba Clouder - December 6, 2017
An online computing service that offers elastic and secure virtual cloud servers to cater all your cloud hosting needs.Learn More
Auto Scaling automatically adjusts computing resources based on your business cycleLearn More
An on-demand database hosting service for MySQL, SQL Server and PostgreSQL with automated monitoring, backup and disaster recovery capabilitiesLearn More
More Posts by Alibaba Clouder