There is a new revision of this tutorial available for Ubuntu 16.04 (Xenial Xerus).

How to Install Wordpress with Nginx, MariaDB and HHVM in Ubuntu 15.04

Introduction

HHVM (Hip Hop Virtual Machine) is a just-in-time compiler developed by Facebook to run applications that are written in PHP and Hack language. HHVM is faster than the traditional PHP engine from ZEND and is used by Facebook to serve billions of web requests per day. HHVM has a 9x higher throughput of web requests and over a 5x reduction in memory consumption compared with the Zend PHP 5.2 engine + APC. see more here.

This tutorial describes the steps to install WordPress with Nginx, MariaDB and HHVM on Ubuntu 15.04 Server - 64bit.

Prerequisites

I assume you have installed on your machine:

  1. Ubuntu 15.04 Server with 64-bit architecture, because HHVM is running on 64-bit only.
  2. That you have root/ sudo access to the server.

So this is what we will do in this tutorial:

  • Install Nginx.
  • Install and Configure MariaDB.
  • Install and Configure HHVM
  • Install and Configure Wordpress

Install Nginx

Nginx web server is available in the Ubuntu repository. You can install it with the apt command:

sudo apt-get update
sudo apt-get install nginx

When the installation is complete, please start Nginx:

systemctl start nginx

Now test with your browser, open the server IP: http://192.168.1.108/. Replace the IP in the URL with your own IP.

Install and Configure MariaDB

In this tutorial, I will install MariaDB as a replacement for MySQL to take advantage of its better performance. MariaDB is a fork of MySQL maintained by the original MySQL Developer Monty Widenius.

Install MariaDB with apt-get command:

sudo apt-get install mariadb-client mariadb-server

Now you can start MariaDB:

sudo systemctl start mysql

When MariaDB is running, set MariaDB root password to secure the database:

mysql_secure_installation

Enter current password for root (enter for none): PRESS ENTER

Set root password? [Y/n] Y
ENTER YOUR PASSWORD

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

Now the root password for MariaDB has been set and you can login to MariaDB prompt with your password.

mysql -u root -p

TYPE YOUR PASSWORD

Now create a new database with the name wordpressdb and new user with the name wpuser for the WordPress installation. You can do that with the commands below. Please replace 'wpuser@' with a secure password that will be used ass access credentials for the new WordPress database.

create database wordpressdb;
create user [email protected] identified by 'wpuser@';
grant all privileges on wordpressdb.* to [email protected] identified by 'wpuser@';
flush privileges;
\q

Install and Configure HHVM

Add the HHVM repository to your Ubuntu repository file /etc/apt/sources.list and update the repository:

wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
echo deb http://dl.hhvm.com/ubuntu vivid main | sudo tee /etc/apt/sources.list.d/hhvm.list
apt-get update

Now let`s install HHVM:

sudo apt-get install -y hhvm

When the installation is finished, configure  the Nginx web server to use HHVM:

sudo /usr/share/hhvm/install_fastcgi.sh

To start HHVM automatically on system boot up, run this command:

sudo update-rc.d hhvm defaults

and we will use HHVM for /usr/bin/php even if you have php-cli installed:

sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60

Now start HHVM:

systemctl start hhvm

Now it is time to test HHVM, I will test it in the browser and on the server console/terminal.

Create new file called info.php in the /var/www/html/ directory:

cd /var/www/html/
nano info.php

And add the PHP code below:

<?php
phpinfo();
?>

Then access the file in your browser: http://192.168.1.108/info.php. If you can see the word HipHop in your web page, then HHVm is working correctly.

Finally test HHVM in your server console/terminal, type this command:

php info.php
php -v

The first command shall show the word "HipHop", the second command the HHVM version.

Installing Wordpress

Download WordPress and extract it:

cd /var/www/html/
wget wordpress.org/latest.zip
unzip latest.zip

Wordpress is extracted into the "wordpress" directory, you will have to move all WordPress files and directories to /var/www/html/, you can do this with the commands below:

cd /var/www/html/
mv wordpress/* .
rm -rf wordpress/

Now change the owner for WordPress files to the user and group www-data, usually all files under /var/www/html/ directory are owned by www-data user and group. Run these commands to change the file and directory ownership:

find . -type d -exec chown www-data:www-data {} \;
find . -type f -exec chown www-data:www-data {} \;

Then rename the file wp-config-sample.php to wp-config.php, and edit the file to set the database name, database user and password that we created during the database setup.

mv wp-config-sample.php wp-config.php
nano wp-config.php

DB_NAME = wordpressdb
DB_USER = wpuser
DB_PASSWORD = wpuser@

Now edit the nginx virtualhost file /etc/nginx/sites-available/default with nano, and add index.php :

rm -f index.nginx.html
nano /etc/nginx/sites-available/default

And then restart Nginx:

systemctl restart nginx

When Nginx is restarted, try to access server IP: http://192.168.1.108/, you will be redirected to the WordPress Installation.

Please choose your language, example: English(United States) and press the button Continue.

Now fill in the username, password that shall be used to authenticate the WordPress administrator and your email address and press the Install Wordpress button.

Wait until the installation is finished, then login to the WordPress site: http://192.168.1.108/wp-login.php and input your username and password, or visit WordPress home page http://192.168.1.108/.

Wordpress is now installed with HHVM under Nginx web server in your Ubuntu 15.04 server.

Conclusion

HHVM is an open source project designed to execute programs written in Hack and PHP language that runs PHP applications faster and with less memory consumption than the traditional ZEND engine. The latest WordPress version runs fine on HHVM.

Share this page:

9 Comment(s)

Add comment

Comments

From: kimhospital

How to install Centmin Mod in Ubuntu ?

From: till

Centmin is a centos only software, so you can't use that on other Linux Distributions. The above instructions install everything that is needed for the WordPress Nginx and HHVM setup, so you don't need a software like Centmin here.

From: Mitesh

You can install NGINX PHP MariaDB PageSpeed and HHVM using EasyEngine.Also EasyEngine provide 12 different caching mechanism for your wordpress.

All above just typing 3 easy commands

From: Mikkie

This guide is for Ubuntu 15.04, Easyengine does not support Ubuntu 15.04 yet. Also, people who want full control over their setup would rather do it manually then using Easyengine. 

From: Gordon

Any reason why this tutorial wouldn't work on 14.04LTS? 

From: Jonathan

Well, what does not work for you?

Please provide woth more information. It is impossible to help out with 0 information like that

From: jack

Hi nice tutorial, when do you have installed ubuntu server which package do you have installed? open ssh?, mail server? 

thanks

From: pikey

nice tutorial

 

but on HHVM I am getting this

The following packages have unmet dependencies:

 hhvm : Depends: libboost-filesystem1.55.0 but it is not installable

        Depends: libboost-program-options1.55.0 but it is not installable

        Depends: libboost-system1.55.0 but it is not installable

        Depends: libboost-system1.55.0 but it is not installable

        Depends: libboost-regex1.55.0 but it is not installable

        Depends: libgnutls-deb0-28 but it is not installable

        Depends: libicu52 but it is not installable

        Depends: libmysqlclient18 but it is not installable

        Depends: libvpx1 but it is not installable

        Depends: libgoogle-glog0 (>= 0.3.1) but it is not installable

        Depends: libboost-thread1.55.0 but it is not installable

        Depends: libboost-context1.55.0 but it is not installable

        Depends: libdouble-conversion1 but it is not installable

        Depends: libre2-1 but it is not installable

 

E: Unable to correct problems, you have held broken packages.

 

 

From: Abdul Rehman

Hey great tutorial working well with 14.04 but you need to do some command changes, and before installing nginx don't for to remove apache2 from your server.