Install WordPress + Nginx, MariaDB, and HHVM in Ubuntu 16.04

ADVERTISEMENT

Install WordPress with Nginx, MariaDB and HHVM in Ubuntu 16.04
Install WordPress + Nginx, MariaDB, and HHVM on Ubuntu 16.04

HHVM is just-in-time compiler developed to run applications that are written in PHP and Hack language. HHVM is faster than traditional PHP engine and is used by Facebook to serve billions of web requests per day.

This article describes the steps to install WordPress with Nginx, MariaDB, and HHVM on Ubuntu 16.04 Server.

ADVERTISEMENT
Article will continue after the ad

Below are the topics we’ll cover in this article.

  • Install Nginx
  • Install and Configure MariaDB
  • Install and Configure HHVM
  • Setup WordPress

Install Nginx:

Nginx package is available from Ubuntu repository, so install it with apt command.

sudo apt-get update
sudo apt-get install -y nginx unzip

Once the installation is complete, start the Nginx service.

sudo systemctl start nginx

Now test the Nginx with your web browser.

http://your-ip-add-ress/

You should get the following “Welcome to nginx” page confirms the Nginx is up and ready to serve the web pages.

Install WordPress with Nginx, MariaDB and HHVM in Ubuntu 16.04 - Nginx Setup
Install WordPress + Nginx, MariaDB, and HHVM on Ubuntu 16.04 – Nginx Setup

Install and Configure MariaDB:

In this article, we will use MariaDB as a replacement for MySQL database. MariaDB is a fork of MySQL maintained by MariaDB Foundation, led by Michael “Monty” Widenius.

MariaDB is available in Ubuntu repository. You can install it with apt command.

sudo apt-get install -y mariadb-client mariadb-server

Start MariaDB service.

sudo systemctl start mysql

Login with the root.

You do not need to enter root password if you execute the mysql with sudo. All you have to do is simply press enter when mysql prompts for root password
sudo mysql -u root -p

create a database for our WordPress installation.

create database wpdatabase;
grant all privileges on wpdatabase.* to wordpress@localhost identified by 'wp@123';
flush privileges;
quit

Where,

Database Name: wpdatabase

User: wordpress

Password: wp@123

Install and Configure HHVM:

Add the HHVM repository to your system.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"

Update the repositories.

sudo apt-get update

Install HHVM.

sudo apt-get install -y hhvm

Once the installation is complete, configure Nginx web server to use HHVM.

sudo /usr/share/hhvm/install_fastcgi.sh

Run this command to start HHVM automatically on system boot up.

sudo update-rc.d hhvm defaults

We’ll use HHVM as a PHP alternative.

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

Now start HHVM.

sudo systemctl start hhvm

Verify the php version. You should get the similar output like below.

$ php -v

HipHop VM 3.15.1 (rel)
Compiler: tags/HHVM-3.15.1-0-g87901df9ba74204dda149af0cfbbb016d85df67e
Repo schema: 426da75d3ec1fb57c98ed95ba8f0ca26a3605b82

Setup WordPress:

Download WordPress and extract it.

cd /tmp
wget https://wordpress.org/latest.zip
unzip latest.zip

WordPress is now extracted into the “wordpress” directory; you will have to move all the files and directories to main directory “/var/www/html“.

sudo mv wordpress/* /var/www/html/

Set the user and group permissions.

sudo chown -R www-data:www-data /var/www/html/

Edit the default Naginx virtual host file “/etc/nginx/sites-available/default

sudo vi /etc/nginx/sites-available/default

Add index.php to index line.

From:

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

To:

index index.php index.html index.htm index.nginx-debian.html;
Install WordPress with Nginx, MariaDB and HHVM in Ubuntu 16.04 - Nginx Virtual Host
Install WordPress + Nginx, MariaDB, and HHVM on Ubuntu 16.04 – Nginx Virtual Host

Restart the Nginx and HHVM services.

sudo systemctl restart nginx
sudo systemctl restart hhvm

Configure WordPress:

Now try to access the WordPress installation through a web browser.

http://your-ip-add-ress/

You should now see the WordPress installation wizard.

Install WordPress with Nginx, MariaDB, and HHVM in Ubuntu 16.04 -WordPress Setup
Install WordPress + Nginx, MariaDB, and HHVM on Ubuntu 16.04 -WordPress Setup

Follow the wizard and set up the WordPress.

  • Enter the database connection details.
  • Enter the blog information including admin user and password.

After the successful completion of setting up, you could be able to access the WordPress blog home page.

Install WordPress with Nginx, MariaDB, and HHVM in Ubuntu 16.04 - WordPress
Install WordPress + Nginx, MariaDB, and HHVM on Ubuntu 16.04 – WordPress

That’s All.

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

Shares