How to install WordPress with Nginx, HHVM and MariaDB on Ubuntu 16.04

Wordpress with Nginx, HHVM and MariaDB

Introduction

If you’ve never heard about HHVM, it’s an open-source Virtual Machine designed for executing programs written in Hack and PHP. For performance reasons, it uses a just-in-time compilation process.
Just like other similar projects, HHVM performs execution in a two-phase approach: first, it compiles PHP and Hack in an intermediate bytecode, then this bytecode is translated into AMD64 machine code at runtime, with a JIT (just-in-time) compiler.
This tutorial demonstrates how to install WordPress with MariaDB, Nginx and, of course, HHVM on Ubuntu 16.04.

Prerequisites

As stated on the official page, HHVM supports only 64 bit architectures, so you need Ubuntu 16.04 Server 64bit.

Install Nginx

First, we install Nginx, which is available in Ubuntu repositories. Execute the following command:

# apt install nginx

The installation process is very quick. When it is complete, start Nginx:

# systemctl start nginx

Install and configure MariaDB

MariaDB is also available in the repository, so just use apt:

# apt-get install mariadb-client mariadb-server

MariaDB is a MySQL fork, and it uses its name for the systemd service:

# systemctl start mysql

Set MariaDB root password to secure your database:

# mysql_secure_installation

You will be asked for the following configuration parameters:

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

Once that step is complete you can access the MariaDB database with your password:

$ mysql -u root -p

Use the MariaDB prompt to create a new database for WordPress. In this tutorial, we use mywordpressdb as the database name, and wordpressuser as the username for the WP installation. So our code looks like this:

	mysql> CREATE DATABASE mywordpressdb;
	mysql> CREATE USER wordpressuser@localhost IDENTIFIED BY 'my_strong_password';
	mysql> GRANT ALL PRIVILEGES ON mywordpressdb.* to wordpressuser@localhost IDENTIFIED BY 'my_strong_password';

Next, you can flush privileges and exit:

	mysql> FLUSH PRIVILEGES;
	mysql> EXIT;

Install HHVM

HHVM is not available in the Ubuntu repository, so, first, it’s necessary to add an external one. This requires editing /etc/apt/sources.list and updating repos. Just execute the following commands:

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

Now, install HHVM with apt:

# apt install -y hhvm

Configure and test HHVM

After installation, in /usr/share/hhvm there is a script for configuring the Nginx web server to use HHVM. Just execute the following:

# /usr/share/hhvm/install_fastcgi.sh

This is a quick process, at the end of which you can start HHVM:

# systemctl start hhvm.service

If you need to run web scripts, and you want it to start at boot, execute the command:

# update-rc.d hhvm defaults

You can decide to use HHVM for /usr/bin/php even if you have a php-cli already installed:

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

Next, you can test HHVM in different ways (for example, you can call it on existing PHP scripts present in your filesystem, just like php-cli). In this case, we use it on the web server. So, create a file called info.php in /var/www/html and enter the following lines:

<?php
phpinfo();
?>

Edit Nginx Virtual Host file, adding in it index.php:

	# $EDITOR /etc/nginx/sites-available/default

Here:

index index.php index.html index.htm index.nginx-debian.html;

After saving, exit, and test. With your browser, go to http://localhost/info.php

Here, you should see HHVM on top of the page: this means that it is working as expected.

Install WordPress

Now, you must install WordPress. This is quite easy, just execute the commands:

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

The unzip command will create a new folder, wordpress. Move all of its content into /var/www/html

	# mv wordpress/* .
	# rm -rf wordpress/

Change the owner for the WordPress files:

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

Rename wp-config-sample.php to wp-config.php, then edit it:

	# mv wp-config-sample.php wp-config.php
	# $EDITOR wp-config.php

Here, change database informations using the one you specified in the MariaDB configuration process:

	DB_NAME = mywordpressdb
	DB_USER = wordpressuser
	DB_PASSWORD = my_strong_password

Restart the server:

	# systemctl restart nginx

After that, go to your server IP, and you will be redirected to the WordPress installation, which is totally created in your web browser.

After filling out all of the required forms, WordPress will be ready for you! And that’s all you need for creating you website with WP on an Ubuntu 16.04 running Nginx, with HHVM.

  • I have profited $104k in last twelve months by freelancing from home a­n­d I manage that by wor­king part time for few h on daily basis. I used an earning opportunity I stumbled upon from company that i found online and I am thrilled that i was able to make such great money. It’s user-friendly a­­n­­d I’m so happy that i found this. This is what i do… STATICTAB.COM/dk8k8gt

  • james.parker.1996@mail.ru

    I profited $104000 in 2016 by working from my home a­n­d I manage to do it by wo­rking part time for several hours /daily. I used work opportunity I was introduced by this website i found on-line and I am happy that i was able to make such great money. It’s really beginner friendly and I am just so grateful that i learned about it. This is what i did… STATICTAB.COM/x4biwaa

  • I have earned 104,000 thousand dollars in last twelve months by freelancing from home a­­n­­d I did it by w­orking part-time f­o­r few hrs /daily. I was following a business model I found online and I am amazed that i made so much money. It’s really user friendly a­n­d I’m just so blessed that I found out about this. Here is what i did… STATICTAB.COM/x4biwaa

  • I profited 104,000 bucks in 2016 by working on-line from home a­n­d I did that by work­ing part time f­o­r 3+ h on daily basis. I was following an earning model I was introduced by this web-site i found on-line and I am amazed that I was able to earn such great money. It’s very beginner-friendly a­­n­­d I’m so happy that I found out about it. Here is what i do… STATICTAB.COM/gpfvgtj

  • tucker-claire

    I was paid $104k in 2016 by working from my home a­­n­­d I did it by w­orking in my own time f­o­r 3 or sometimes more h a day. I was following an earning model I found online and I am happy that i made such great money. It’s very newbie-friendly a­n­d I’m so thankful that i discovered it. Here is what i do… STATICTAB.COM/owgxpdb

  • I got paid $104,000 last year by freelancing on-line a­n­d I did it by wo­rking part-time f­­o­­r few hrs each day. I used an earning opportunity I stumbled upon online and I am so amazed that i earned so much money. It’s really newbie-friendly a­n­d I’m just so grateful that I found out about this. This is what i did… STATICTAB.COM/r2tyhgi

  • ruth.quigley@mail.ru

    I have profited $104000 in last 12 months by freelancing online and I did it by wo­rking part-time f­o­r 3+ hours /day. I followed a money making opportunity I was introduced by this web-site i found online and I am so excited that i earned so much extra income. It’s really beginner friendly and I am just so blessed that i found it. This is what i did… STATICTAB.COM/astkxim

  • I’ve made 104,000 bucks in last 12 months by freelancing on-line and I did it by wo­rking part time f­o­r 3+ h every day. I’m using a business opportunity I came across online and I am amazed that I was able to earn so much money on the side. It’s very beginner-friendly a­n­d I’m just so happy that i found it. This is what i did… STATICTAB.COM/astkxim

  • william.parker.94@mail.ru

    I’ve earned 104,000 bucks in 2016 by working online from home and I was able to do it by wo­rking in my own time for 3 or sometimes more h /day. I was following work model I came across online and I am happy that I was able to earn so much extra income. It’s really beginner friendly a­­n­­d I am just so happy that I found out about this. Here is what i did… STATICTAB.COM/owgxpdb

  • I got paid 104,000 bucks in last 12 months by doing an online job at my house a­n­d I did that by work­ing part-time f­­o­­r 3 or sometimes more h /daily. I followed a money making model I was introduced by this web-site i found on-line and I am so excited that I was able to earn so much extra income. It’s so user-friendly a­­n­­d I’m just so happy that I found out about this. Check out what I do… please visit my account for webpage

  • I got paid 104,000 bucks in last 12 months by freelancing on-line a­­n­­d I was able to do it by work­ing in my own time f­o­r 3+ hours daily. I followed work opportunity I was introduced by this company i found online and I am thrilled that i made so much money on the side. It’s really newbie friendly and I am just so happy that i found it. Here’s what I do…TWITTER.COM/StinnettMargar1/status/835739136078163968

  • I have profited 104 thousand dollars in 2016 by working from my home a­­n­­d I manage to do it by working part time f­­o­­r several hrs daily. I was following work model I came across from company that i found online and I am excited that i made so much money on the side. It’s so newbie-friendly and I’m so happy that i found it. This is what i do… EASYURL.NET/523c8

  • I have made $104000 last year by working on-line from home and I did that by wo­rking in my own time for 3+ hours daily. I used a money making model I found on-line and I am so excited that i made such great money. It’s user friendly and I’m just so happy that I found out about it. This is what i do… SHORTME.ORG/c0muf

  • larry.beggs@mail.ru

    I have profited $104k previous year by freelancing on-line a­n­d I did that by w­orking in my own time f­o­r 3 or sometimes more hours daily. I’m using an earning model I found on-line and I am excited that I was able to earn so much money. It’s really beginner friendly a­­n­­d I’m so happy that I found out about this. Here’s what I do… http://jump­.­wtf/CCcHHu1

  • I was without work for 6 months when my early Fellow worker finally strongly recommended me to begin with freelancing at home… It was really after I gained $5000 in my initial month when I actually believed I could do this for a living! At this moment I am delightful than ever… I work-from-home as well as I am my own boss now that I always wanted… I see a large number of unsatisfied people around me, working the same old boring job that is sucking the everyday life from all of them day by day… Whenever I see anybody like that I say START FREELANCING MAN! This is where I started >>>> http://libr­.­ae/5qMk