Recently we showed you how to install HHVM(Hip Hop Virtual Machine) just-in-time compiler written in PHP developed by Facebook. Most webmasters have argued that HHVM is faster than traditional PHP engine from ZEND.
To read the post on installing HHVM on Ubuntu, please click here or click the link below.
https://www.liberiangeek.net/2015/07/how-to-install-and-configure-hhvm-on-ubuntu-15-04/
This tutorial is going to show you how to install WordPress on top of Nginx with support for MariaDB, HHVM on Ubuntu 15.04.
Traditionally, webmaster will run the LEMP stack with Nginx, MySQL, and PHP. This post replaces PHP with HHVM to enhance your blog or website performance.
For this tutorial, we will want to install the latest version of Nginx web server. By default, the Ubuntu repository only carries Nginx stable and not the latest or newest.
To install the latest version of Nginx on Ubuntu, read this post. Or click on the link below.
https://www.liberiangeek.net/2014/10/install-latest-version-nginx-ubuntu-14-10/
After installing Nginx, continue below to install MariaDB database server on Ubuntu.
To install MariaDB database server on Ubuntu, run the commands below.
sudo apt-get install mariadb-server mariadb-client
To start up MariaDB, run the commands below.
sudo systemctl start mysql
Next, run the commands below to configure MariaDB server
sudo mysql_secure_installation
When prompted, follow the options below
Next, choose Yes for the rest of the prompts until you’re done.
- Enter current password for root (enter for none): Press Enter for none.
- Set root password? Y
- Remove anonymous users? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
The database server configuration is done.
Next, create a database for WordPress to use. WordPress needs databases to store its content.
Run the commands below to sign onto the database. When prompted for a password, type the root password you created in the earlier steps.
mysql -u root -p
Next, run the commands below to create a new database called wpdb.
CREATE DATABASE wpdb;
Next, run the commands below to create a new database user called wpuser with a new password.
CREATE USER wpuser@localhost IDENTIFIED BY 'new_password_here';
Then run the commands below to give the user full access to the newly created database you created earlier.
GRANT ALL ON wpdb.* to wpuser@localhost;
Finally, run the commands below to refresh the database permissions table and exit.
FLUSH PRIVILEGES;
exit.
Next, go and install HHVM on Ubuntu. We’ve already covered it on this blog so no need to rewrite that tutorial.
To install and configure HHVM on Ubuntu, follow and continue to this page or click the link below on installing and configuring HHVM on Ubuntu 15.04
https://www.liberiangeek.net/2015/07/how-to-install-and-configure-hhvm-on-ubuntu-15-04/
Now that Nginx, MariaDB and HHVM are installed, let’s go and downlaod WordPress’ content. By default, Nginx creates and make /use/share/nginx/html its default root directory. So content at this location will be fetched and retrieve when requested.
To access WordPress content, put it in Nginx default root directory (/usr/share/nginx/html).. To do that run the commands below to download WordPress latest content.
cd /tmp/ && wget http://wordpress.org/latest.tar.gz
Then run the commands below to extract that content.
tar -xvzf latest.tar.gz
Finally, copy all WordPress content to the root directory for Nginx
sudo mv wordpress/* /usr/share/nginx/html/
After copying WordPress content, go and copy WordPress sample file and create a wp-config.php file.
sudo cp /usr/share/nginx/html/wp-config-sample.php /usr/share/nginx/html/wp-config.php
Then open wp-config.php file and make the following changes to including the database info.
sudo vi /usr/share/nginx/html/wp-config.php
Add the database name, username and password.
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wpdb‘);
/** MySQL database username */
define(‘DB_USER’, ‘wpuser‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘password‘);
Next, change the permissions on the root folder by running the commands below.
sudo chown -R www-data:www-data /usr/share/nginx/html/
sudo chmod -R 755 /usr/share/nginx/html/
Finally, open Nginx’s default site file at /etc/nginx/sites-available/default by running the commands below.
sudo vi /etc/nginx/conf.d/default.conf
Then make the follow change to enable PHP support.
Under root /usr/share/nginx/html; add
index index.php index.html index.htm;
Since Ubuntu adds a sample html page, it’s best to remove it.
sudo rm -f /usr/share/nginx/html/nginx.html
Finally, restart Nginx
sudo systemctl restart nginx
Then browse to the host IP or hostname and WordPress configuration page should appear.
Continue with configuring WordPress.
Enjoy!